Skip to content

Commit

Permalink
Fix "Combine Items" button overlap with "Use as substitution" (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
miozune authored Dec 13, 2022
1 parent 74b1ed4 commit d308756
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 17 deletions.
25 changes: 18 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//version: 1666118075
//version: 1670779107
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates.
Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/master/build.gradle for updates.
*/


Expand Down Expand Up @@ -31,7 +31,7 @@ buildscript {
url 'https://maven.minecraftforge.net'
}
maven {
// GTNH ForgeGradle Fork
// GTNH ForgeGradle and ASM Fork
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
Expand All @@ -45,7 +45,9 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.9'
//Overwrite the current ASM version to fix shading newer than java 8 applicatations.
classpath 'org.ow2.asm:asm-debug-all-custom:5.0.3'
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.11'
}
}
plugins {
Expand Down Expand Up @@ -330,6 +332,12 @@ repositories {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
if (usesMixinDebug.toBoolean()) {
maven {
name = "Fabric Maven"
url = "https://maven.fabricmc.net/"
}
}
}
}

Expand All @@ -338,10 +346,13 @@ dependencies {
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
annotationProcessor('com.google.guava:guava:24.1.1-jre')
annotationProcessor('com.google.code.gson:gson:2.8.6')
annotationProcessor('org.spongepowered:mixin:0.8.5-GTNH:processor')
annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.3:processor')
if (usesMixinDebug.toBoolean()) {
runtimeOnly('org.jetbrains:intellij-fernflower:1.2.1.16')
}
}
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
compile('com.gtnewhorizon:gtnhmixins:2.0.1')
compile('com.gtnewhorizon:gtnhmixins:2.1.3')
}
}

Expand Down Expand Up @@ -694,7 +705,7 @@ if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) {
}
}
if (usesMixins.toBoolean()) {
addModrinthDep("required", "version", "gtnhmixins")
addModrinthDep("required", "project", "gtnhmixins")
}
tasks.modrinth.dependsOn(build)
tasks.publish.dependsOn(tasks.modrinth)
Expand Down
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dependencies {
compile("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-104-GTNH:dev")
compile("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-122-GTNH:dev")
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.5:dev")
compile("com.github.GTNewHorizons:CodeChickenCore:1.1.6:dev")
compile("com.github.GTNewHorizons:NotEnoughItems:2.3.2-GTNH:dev")
Expand Down
27 changes: 18 additions & 9 deletions src/main/java/com/github/vfyjxf/nee/client/GuiEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class GuiEventHandler implements INEIGuiHandler {

private GuiImgButtonEnableCombination buttonCombination;
private boolean hasDoubleBtn = true;
private boolean hasBeSubstituteBtn = true;

@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event) {
Expand Down Expand Up @@ -97,17 +98,25 @@ public void onInitGui(GuiScreenEvent.InitGuiEvent.Post event) {
} catch (NoSuchFieldException e) {
hasDoubleBtn = false;
}
if (hasDoubleBtn) {
buttonCombination = new GuiImgButtonEnableCombination(
gui.guiLeft + 84,
gui.guiTop + gui.ySize - 153,
ItemCombination.valueOf(NEEConfig.itemCombinationMode));
try {
GuiPatternTerm.class.getDeclaredField("beSubstitutionsEnabledBtn");
} catch (NoSuchFieldException e) {
hasBeSubstituteBtn = false;
}

int x, y;
if (hasDoubleBtn && hasBeSubstituteBtn) {
x = gui.guiLeft + 84;
y = gui.guiTop + gui.ySize - 143;
} else if (hasDoubleBtn) {
x = gui.guiLeft + 84;
y = gui.guiTop + gui.ySize - 153;
} else {
buttonCombination = new GuiImgButtonEnableCombination(
gui.guiLeft + 74,
gui.guiTop + gui.ySize - 153,
ItemCombination.valueOf(NEEConfig.itemCombinationMode));
x = gui.guiLeft + 74;
y = gui.guiTop + gui.ySize - 153;
}
buttonCombination =
new GuiImgButtonEnableCombination(x, y, ItemCombination.valueOf(NEEConfig.itemCombinationMode));
event.buttonList.add(buttonCombination);
}
}
Expand Down

0 comments on commit d308756

Please sign in to comment.