From 4e1beb536a7d01d50714ec875216bb36a1c82d1c Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Fri, 12 Nov 2021 17:32:28 +0000 Subject: [PATCH 1/3] Updated IC2 version. Fixed IC2 IBoxable handler. --- build.properties | 2 +- src/main/java/gregtech/api/util/GT_ModHandler.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build.properties b/build.properties index 599c8cf089..959daa0c13 100644 --- a/build.properties +++ b/build.properties @@ -1,4 +1,4 @@ minecraft.version=1.7.10 forge.version=10.13.4.1614-1.7.10 -ic2.version=2.2.790-experimental +ic2.version=2.2.817-experimental gt.version=5.09.31 \ No newline at end of file diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index 1419ed562d..7deb9e37d9 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -82,7 +82,7 @@ public class GT_ModHandler { public static volatile int VERSION = 509; public static Collection sNativeRecipeClasses = new HashSet(), sSpecialRecipeClasses = new HashSet(); public static GT_HashSet sNonReplaceableItems = new GT_HashSet(); - public static Object sBoxableWrapper = GT_Utility.callConstructor("gregtechmod.api.util.GT_IBoxableWrapper", 0, null, false); + public static Object sBoxableWrapper = new GT_IBoxableWrapper(); private static Map sExtractorRecipes = new /*Concurrent*/HashMap(); private static Map sMaceratorRecipes = new /*Concurrent*/HashMap(); private static Map sCompressorRecipes = new /*Concurrent*/HashMap(); @@ -1886,11 +1886,13 @@ public static void registerBoxableItemToToolBox(ItemStack aStack) { if (aStack != null) registerBoxableItemToToolBox(aStack.getItem()); } - public static void registerBoxableItemToToolBox(Item aItem) { + public static void registerBoxableItemToToolBox(Item aItem) { if (aItem != null && sBoxableWrapper != null) { try { ic2.api.item.ItemWrapper.registerBoxable(aItem, (IBoxable) sBoxableWrapper); - } catch (Throwable e) {/*Do nothing*/} + } catch (Throwable e) { + e.printStackTrace(); + } } } From d7ea46e5944abbba75f712f9b3df0a45b56f8807 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Fri, 12 Nov 2021 18:00:15 +0000 Subject: [PATCH 2/3] Implemented support for IC2 Toolbox to fix Maint. issues. --- .../GT_MetaTileEntity_Hatch_Maintenance.java | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java index d7dcbdd9ca..1706260538 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java @@ -17,6 +17,9 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; +import ic2.core.IHasGui; +import ic2.core.Ic2Items; +import ic2.core.item.ItemToolbox; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; @@ -25,6 +28,7 @@ import net.minecraft.nbt.NBTTagCompound; import java.util.Arrays; +import java.util.HashSet; import java.util.List; public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch { @@ -186,7 +190,27 @@ public boolean autoMaintainance() { } public void onToolClick(ItemStack aStack, EntityLivingBase aPlayer) { - if (aStack == null || aPlayer == null) return; + if (aStack == null || aPlayer == null) return; + + // Allow IC2 Toolbox with tools to function for maint issues. + if (aStack.getItem() instanceof ItemToolbox && aPlayer instanceof EntityPlayer) { + EntityPlayer aPlayerEntity = (EntityPlayer) aPlayer; + ItemToolbox aToolbox = (ItemToolbox) aStack.getItem(); + IHasGui aToolboxGUI = aToolbox.getInventory(aPlayerEntity, aStack); + HashSet aToolboxContents = new HashSet(); + for (int i=0; i Date: Fri, 12 Nov 2021 18:23:42 +0000 Subject: [PATCH 3/3] Only damage tools when doing maintenance if they actually need to be. --- .../GT_MetaTileEntity_Hatch_Maintenance.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java index 1706260538..60c724ded9 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java @@ -211,17 +211,17 @@ public void onToolClick(ItemStack aStack, EntityLivingBase aPlayer) { } } - if (GT_Utility.isStackInList(aStack, GregTech_API.sWrenchList) && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) + if (GT_Utility.isStackInList(aStack, GregTech_API.sWrenchList) && !mWrench && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mWrench = true; - if (GT_Utility.isStackInList(aStack, GregTech_API.sScrewdriverList) && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) + if (GT_Utility.isStackInList(aStack, GregTech_API.sScrewdriverList) && !mScrewdriver && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mScrewdriver = true; - if (GT_Utility.isStackInList(aStack, GregTech_API.sSoftHammerList) && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) + if (GT_Utility.isStackInList(aStack, GregTech_API.sSoftHammerList) && !mSoftHammer && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mSoftHammer = true; - if (GT_Utility.isStackInList(aStack, GregTech_API.sHardHammerList) && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) + if (GT_Utility.isStackInList(aStack, GregTech_API.sHardHammerList) && !mHardHammer && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mHardHammer = true; - if (GT_Utility.isStackInList(aStack, GregTech_API.sCrowbarList) && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) + if (GT_Utility.isStackInList(aStack, GregTech_API.sCrowbarList) && !mCrowbar && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) mCrowbar = true; - if (GT_ModHandler.useSolderingIron(aStack, aPlayer)) mSolderingTool = true; + if (!mSolderingTool && GT_ModHandler.useSolderingIron(aStack, aPlayer)) mSolderingTool = true; if (GT_OreDictUnificator.isItemStackInstanceOf(aStack, "craftingDuctTape")) { mWrench = mScrewdriver = mSoftHammer = mHardHammer = mCrowbar = mSolderingTool = true; getBaseMetaTileEntity().setActive(false);