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] 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 d7dcbdd9..17062605 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.objects.GT_RenderedTexture; 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.item.ItemStack; 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 class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch } 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