Skip to content

Commit

Permalink
Merge pull request #59 from GTNewHorizons/fix-crash
Browse files Browse the repository at this point in the history
Fix crash when starting autocraft from arcane terminal
  • Loading branch information
boubou19 authored Mar 12, 2024
2 parents 724e650 + 8a91803 commit d0b230b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 46 deletions.
10 changes: 5 additions & 5 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// Add your dependencies here

dependencies {
implementation("com.github.GTNewHorizons:NotEnoughItems:2.5.4-GTNH:dev")
implementation("com.github.GTNewHorizons:NotEnoughItems:2.5.24-GTNH:dev")
implementation("com.github.GTNewHorizons:CodeChickenLib:1.2.1:dev")
implementation("com.github.GTNewHorizons:CodeChickenCore:1.2.1:dev")
implementation("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-310-GTNH:dev")
implementation("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-336-GTNH:dev")
implementation("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev")
implementation("curse.maven:thaumcraft-nei-plugin-225095:2241913") { transitive = false }

compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.34:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:AE2FluidCraft-Rework:1.2.11-gtnh:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:waila:1.6.5:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.45.25:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:AE2FluidCraft-Rework:1.2.19-gtnh:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:waila:1.7.1:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.45.97:dev") { transitive = false }
compileOnly("curse.maven:computercraft-67504:2269339") { transitive = false }
compileOnly("curse.maven:cofh-lib-220333:2388748") { transitive = false }
compileOnly("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") { transitive = false }
Expand Down
9 changes: 5 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ channel = stable
mappingsVersion = 12

# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/

# Select a default username for testing your mod. You can always override this per-run by running
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
Expand Down Expand Up @@ -61,6 +61,9 @@ gradleTokenModId =
# [DEPRECATED] Mod name replacement token.
gradleTokenModName =

# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName =

# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
Expand Down Expand Up @@ -123,7 +126,7 @@ includeWellKnownRepositories = true
usesMavenPublishing = true

# Maven repository to publish the mod to.
# mavenPublishUrl = https://nexus.gtnewhorizons.com/repository/releases/
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/

# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
Expand Down Expand Up @@ -187,5 +190,3 @@ curseForgeRelations =
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true

# Non-GTNH properties
gradleTokenGroupName =
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.8'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.17'
}


Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package thaumicenergistics.client.gui;

import java.lang.reflect.Field;

import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

import appeng.client.gui.implementations.GuiCraftAmount;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.core.localization.GuiText;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import thaumicenergistics.api.grid.ICraftingIssuerHost;
Expand Down Expand Up @@ -39,16 +35,6 @@ public class GuiCraftAmountBridge extends GuiCraftAmount {
*/
protected EntityPlayer player;

/**
* The next button.
*/
protected GuiButton buttonNext;

/**
* The amount-to-craft text box.
*/
protected GuiTextField amountToCraft;

public GuiCraftAmountBridge(final EntityPlayer player, final ICraftingIssuerHost craftingHost) {
// Call super
super(player.inventory, craftingHost);
Expand All @@ -65,16 +51,16 @@ protected void actionPerformed(final GuiButton btn) {
if (btn == this.buttonReturnToTerminalHost) {
// Change back to host GUI
this.host.launchGUI(this.player);
} else if (btn == this.buttonNext) {
} else if (btn == this.nextBtn) {
try {
// Parse the amount
long amount = Long.parseLong(this.amountToCraft.getText());
long amount = Long.parseLong(this.amountTextField.getText());

// Ask server to show confirm gui
Packet_S_ConfirmCraftingJob.sendConfirmAutoCraft(this.player, amount, isShiftKeyDown());
} catch (final NumberFormatException e) {
// Reset amount to 1
this.amountToCraft.setText("1");
this.amountTextField.setText("1");
}
} else {
// Call super
Expand All @@ -99,24 +85,5 @@ public void initGui() {
myIcon.getDisplayName(),
itemRender);
this.buttonList.add(this.buttonReturnToTerminalHost);

// Get the next button
for (Object buttonObj : this.buttonList) {
if (buttonObj instanceof GuiButton) {
GuiButton button = (GuiButton) buttonObj;
if (button.displayString == GuiText.Next.getLocal()) {
this.buttonNext = button;
break;
}
}
}

// Get the amount to craft
Field atcField;
try {
atcField = GuiCraftAmount.class.getDeclaredField("amountToCraft");
atcField.setAccessible(true);
this.amountToCraft = (GuiTextField) atcField.get(this);
} catch (Exception e) {}
}
}

0 comments on commit d0b230b

Please sign in to comment.