Merge toolbox change

Implement toolboxable tools from GTNH/GT5U

All credit to GTNH team.
This commit is contained in:
Mikhail 2022-07-21 20:17:48 -05:00
parent 77a3c956e5
commit a6295cbc86
8 changed files with 204 additions and 122 deletions

View file

@ -1,14 +1,9 @@
buildscript { buildscript {
repositories { repositories {
mavenCentral() mavenCentral()
jcenter()
//maven {
// name = "forge"
// url = "http://files.minecraftforge.net/maven"
//}
maven { maven {
name = "gt" name = "forge"
url = "https://gregtech.overminddl1.com/" url = "http://files.minecraftforge.net/maven"
} }
maven { maven {
name = "sonatype" name = "sonatype"
@ -20,30 +15,10 @@ buildscript {
} }
} }
// Because Forge is too stupid to fix Deprecation Issues, and we cannot fix it on our end! (until we fork Forge)
allprojects {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}
}
apply plugin: 'eclipse'
eclipse {
classpath {
downloadJavadoc = true
downloadSources = true
}
}
apply plugin: 'idea'
idea{
module {
downloadJavadoc = true
downloadSources = true
}
}
apply plugin: 'forge' apply plugin: 'forge'
apply plugin: 'idea'
idea.module.inheritOutputDirs = true
file "build.properties" withReader { file "build.properties" withReader {
def prop = new Properties() def prop = new Properties()
@ -51,24 +26,24 @@ file "build.properties" withReader {
ext.config = new ConfigSlurper().parse prop ext.config = new ConfigSlurper().parse prop
} }
allprojects {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
}
}
version = "${config.gt.version}" version = "${config.gt.version}"
group= "gregtech" group= "gregtech"
archivesBaseName = "gregtech" archivesBaseName = "gregtech"
sourceCompatibility = 1.7 sourceCompatibility = 1.7
targetCompatibility = 1.7 targetCompatibility = 1.7
compileJava.options.bootClasspath = org.gradle.internal.jvm.Jvm.current().getJre().getHomeDir().toString() +"/lib/rt.jar"
compileJava {
options.encoding = "UTF-8"
}
minecraft { minecraft {
version = "${config.minecraft.version}-${config.forge.version}" version = "${config.minecraft.version}-${config.forge.version}"
runDir = "eclipse" runDir = "eclipse"
} }
idea { module { inheritOutputDirs = true } }
configurations { configurations {
provided provided
embedded embedded
@ -76,21 +51,40 @@ configurations {
} }
repositories { repositories {
//maven {
// name 'Forge'
// url 'http://files.minecraftforge.net/maven'
//}
maven { maven {
name = "gt" name = "gt"
url = "http://gregtech.overminddl1.com/" url = "https://gregtech.overminddl1.com/"
} }
maven { maven {
name = "ic2" name = "chickenbones"
url = "http://chickenbones.net/maven/"
}
maven {
name = "ic2, forestry"
url = "http://maven.ic2.player.to/" url = "http://maven.ic2.player.to/"
} }
maven { // EnderIO & EnderCore
name 'tterrag Repo'
url "http://maven.tterrag.com"
}
maven { // AppleCore
url "http://www.ryanliptak.com/maven/"
}
maven {
name = "Covers (COFH)"
url = "http://maven.covers1624.net/"
}
maven {
name = "local"
url = "file:///C:/Users/michael/Documents/forge/maven/"
}
} }
dependencies { dependencies {
// compile fileTree(dir: 'libs', include: '*.jar')
// Mostly Used for compileOnly, if you prefer normal IC2, uncomment it instead.
//provided "net.industrial-craft:industrialcraft-2:${config.ic2.version}:dev"
compile "ic2:IC2Classic:1.2.1.8:dev" compile "ic2:IC2Classic:1.2.1.8:dev"
compile "mcp.mobius.waila:Waila:1.5.11-RC2-NONEI_1.7.10:dev" compile "mcp.mobius.waila:Waila:1.5.11-RC2-NONEI_1.7.10:dev"
@ -116,7 +110,6 @@ dependencies {
compileOnly "appeng:appliedenergistics2:rv3-beta-6:dev" compileOnly "appeng:appliedenergistics2:rv3-beta-6:dev"
compileOnly "applecore:AppleCore:1.7.10-3.1.1:deobf" compileOnly "applecore:AppleCore:1.7.10-3.1.1:deobf"
compileOnly "com.shedar.IC2NuclearControl:IC2NuclearControl:2.4.3a:dev" compileOnly "com.shedar.IC2NuclearControl:IC2NuclearControl:2.4.3a:dev"
} }
processResources processResources
@ -125,35 +118,34 @@ processResources
inputs.property "version", project.version inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else ext.srcFiles = "$projectDir/src/main/resources"
from(sourceSets.main.resources.srcDirs) { ext.destDir = "$projectDir/build/classes/main"
include 'mcmod.info'
// registering inputs & outputs allow gradle to skip if UP-TO-DATE
inputs.files srcFiles
outputs.dir destDir
println 'starting processResources'
println 'srcFiles: ' + srcFiles
println 'destDir: ' + destDir
copy {
// replace stuff in mcmod.info, nothing else
from(srcFiles)
into(destDir)
include 'mcmod.info'
// replace version and mcversion // replace version and mcversion
expand 'version': project.version, 'mcversion': project.minecraft.version expand 'version': project.version, 'mcversion': project.minecraft.version
} }
copy {
// copy everything else, thats not the mcmod.info // copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) { from(srcFiles)
into(destDir)
exclude 'mcmod.info' exclude 'mcmod.info'
}
exclude '**/Thumbs.db'
}
task sourceJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
task devJar(type: Jar) {
from sourceSets.main.output
classifier = 'dev'
manifest {
//attributes 'FMLCorePlugin': 'WhateverLoaderClass'
//attributes 'FMLCorePluginContainsFMLMod': 'true'
} }
} }
artifacts {
archives devJar
}

View file

@ -1,4 +1,24 @@
minecraft.version=1.7.10 minecraft.version=1.7.10
forge.version=10.13.4.1614-1.7.10 forge.version=10.13.4.1566-1.7.10
gt.version=5.09.31.1
ae2.version=rv2-beta-33
applecore.version=1.7.10-1.2.1+107.59407
buildcraft.version=7.1.11
codechickenlib.version=1.1.3.140
codechickencore.version=1.0.7.47
cofhcore.cf=2246/920
cofhcore.version=[1.7.10]3.0.3-303-dev
cofhlib.cf=2246/918
cofhlib.version=[1.7.10]1.0.3-175-dev
enderio.cf=2219/296
enderio.version=1.7.10-2.3.0.417_beta
enderiocore.version=1.7.10-0.1.0.25_beta
forestry.version=4.2.10.58
ic2.version=2.2.790-experimental ic2.version=2.2.790-experimental
gt.version=5.09.31 nei.version=1.0.3.57
railcraft.cf=2219/321
railcraft.version=1.7.10-9.4.0.0
nc.cf=2275/987
nc.version=2.3.4a

View file

@ -7,6 +7,7 @@ import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.OrePrefixes;
import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.IIconContainer;
import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility; import gregtech.api.util.GT_Utility;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
@ -61,6 +62,7 @@ public abstract class GT_MetaGenerated_Item_X32 extends GT_MetaGenerated_Item {
} }
if ((tPrefix == OrePrefixes.stick || tPrefix == OrePrefixes.wireFine || tPrefix == OrePrefixes.ingot) && (tMaterial == Materials.Lead || tMaterial == Materials.Tin || tMaterial == Materials.SolderingAlloy)) { if ((tPrefix == OrePrefixes.stick || tPrefix == OrePrefixes.wireFine || tPrefix == OrePrefixes.ingot) && (tMaterial == Materials.Lead || tMaterial == Materials.Tin || tMaterial == Materials.SolderingAlloy)) {
GregTech_API.sSolderingMetalList.add(tStack); GregTech_API.sSolderingMetalList.add(tStack);
GT_ModHandler.registerBoxableItemToToolBox(tStack);
} }
} }
} }

View file

@ -78,7 +78,6 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
*/ */
public GT_MetaGenerated_Tool(String aUnlocalized) { public GT_MetaGenerated_Tool(String aUnlocalized) {
super(aUnlocalized); super(aUnlocalized);
GT_ModHandler.registerBoxableItemToToolBox(this);
setCreativeTab(GregTech_API.TAB_GREGTECH); setCreativeTab(GregTech_API.TAB_GREGTECH);
setMaxStackSize(1); setMaxStackSize(1);
sInstances.put(getUnlocalizedName(), this); sInstances.put(getUnlocalizedName(), this);
@ -166,6 +165,7 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
} }
if (GregTech_API.sThaumcraftCompat != null) if (GregTech_API.sThaumcraftCompat != null)
GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false);
GT_ModHandler.registerBoxableItemToToolBox(rStack);
return rStack; return rStack;
} }
return null; return null;

View file

@ -1,6 +1,7 @@
package gregtech.api.items; package gregtech.api.items;
import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_ModHandler;
import net.minecraft.item.ItemStack;
/** /**
* This is just a basic Tool, which has normal durability and could break Blocks. * This is just a basic Tool, which has normal durability and could break Blocks.
@ -20,6 +21,6 @@ public class GT_Tool_Item extends GT_Generic_Item {
setMaxStackSize(1); setMaxStackSize(1);
setNoRepair(); setNoRepair();
setFull3D(); setFull3D();
GT_ModHandler.registerBoxableItemToToolBox(this); GT_ModHandler.registerBoxableItemToToolBox(new ItemStack(this));
} }
} }

View file

@ -17,14 +17,22 @@ import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility; 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.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.FakePlayer;
import com.mojang.authlib.GameProfile;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet;
import java.util.List; import java.util.List;
public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch { public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch {
@ -110,9 +118,19 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
} }
@Override @Override
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) { public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
if (aBaseMetaTileEntity.isClientSide()) return true; if (aBaseMetaTileEntity.isClientSide())
if (aSide == aBaseMetaTileEntity.getFrontFacing()) aBaseMetaTileEntity.openGUI(aPlayer); return true;
if (aSide == aBaseMetaTileEntity.getFrontFacing()) {
// only allow OC robot fake player
if (aPlayer instanceof FakePlayer && !aPlayer.getGameProfile().getName().endsWith(".robot"))
return true;
if (aPlayer.getCurrentEquippedItem() != null && aPlayer.getCurrentEquippedItem().getItem() instanceof ItemToolbox)
applyToolbox(aPlayer.getCurrentEquippedItem(), aPlayer);
else
aBaseMetaTileEntity.openGUI(aPlayer);
}
return true; return true;
} }
@ -185,19 +203,24 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
return false; return false;
} }
public void onToolClick(ItemStack aStack, EntityLivingBase aPlayer) { public void onToolClick(ItemStack aStack, EntityLivingBase aPlayer, IInventory aToolboxInventory) {
if (aStack == null || aPlayer == null) return; if (aStack == null || aPlayer == null) return;
if (GT_Utility.isStackInList(aStack, GregTech_API.sWrenchList) && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer)) if (aStack.getItem() instanceof ItemToolbox && aPlayer instanceof EntityPlayer) {
applyToolbox(aStack, (EntityPlayer)aPlayer);
return;
}
if (GT_Utility.isStackInList(aStack, GregTech_API.sWrenchList) && !mWrench && GT_ModHandler.damageOrDechargeItem(aStack, 1, 1000, aPlayer))
mWrench = true; 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; 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; 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; 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; mCrowbar = true;
if (GT_ModHandler.useSolderingIron(aStack, aPlayer)) mSolderingTool = true; if (!mSolderingTool && GT_ModHandler.useSolderingIron(aStack, aPlayer, aToolboxInventory))
mSolderingTool = true;
if (GT_OreDictUnificator.isItemStackInstanceOf(aStack, "craftingDuctTape")) { if (GT_OreDictUnificator.isItemStackInstanceOf(aStack, "craftingDuctTape")) {
mWrench = mScrewdriver = mSoftHammer = mHardHammer = mCrowbar = mSolderingTool = true; mWrench = mScrewdriver = mSoftHammer = mHardHammer = mCrowbar = mSolderingTool = true;
getBaseMetaTileEntity().setActive(false); getBaseMetaTileEntity().setActive(false);
@ -212,6 +235,18 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
} }
} }
public void onToolClick(ItemStack aStack, EntityLivingBase aPlayer) {
onToolClick(aStack, aPlayer, null);
}
private void applyToolbox(ItemStack aStack, EntityPlayer aPlayer) {
ItemToolbox aToolbox = (ItemToolbox) aStack.getItem();
IHasGui aToolboxGUI = aToolbox.getInventory(aPlayer, aStack);
for (int i=0; i<aToolboxGUI.getSizeInventory(); i++)
onToolClick(aToolboxGUI.getStackInSlot(i), aPlayer, aToolboxGUI);
}
@Override @Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
if(!(mAuto && GT_Mod.gregtechproxy.mAMHInteraction)) if(!(mAuto && GT_Mod.gregtechproxy.mAMHInteraction))

View file

@ -6,6 +6,6 @@ import net.minecraft.item.ItemStack;
public class GT_IBoxableWrapper implements IBoxable { public class GT_IBoxableWrapper implements IBoxable {
@Override @Override
public boolean canBeStoredInToolbox(ItemStack itemstack) { public boolean canBeStoredInToolbox(ItemStack itemstack) {
return true; return GT_Utility.isStackInList(itemstack, GT_ModHandler.sBoxableItems);
} }
} }

View file

@ -51,6 +51,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
@ -82,7 +83,8 @@ public class GT_ModHandler {
public static volatile int VERSION = 509; public static volatile int VERSION = 509;
public static Collection<String> sNativeRecipeClasses = new HashSet<String>(), sSpecialRecipeClasses = new HashSet<String>(); public static Collection<String> sNativeRecipeClasses = new HashSet<String>(), sSpecialRecipeClasses = new HashSet<String>();
public static GT_HashSet<GT_ItemStack> sNonReplaceableItems = new GT_HashSet<GT_ItemStack>(); public static GT_HashSet<GT_ItemStack> sNonReplaceableItems = new GT_HashSet<GT_ItemStack>();
public static Object sBoxableWrapper = GT_Utility.callConstructor("gregtechmod.api.util.GT_IBoxableWrapper", 0, null, false); public static Object sBoxableWrapper = new GT_IBoxableWrapper();
public static Collection<GT_ItemStack> sBoxableItems = new ArrayList<>();
private static Map<IRecipeInput, RecipeOutput> sExtractorRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>(); private static Map<IRecipeInput, RecipeOutput> sExtractorRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>();
private static Map<IRecipeInput, RecipeOutput> sMaceratorRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>(); private static Map<IRecipeInput, RecipeOutput> sMaceratorRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>();
private static Map<IRecipeInput, RecipeOutput> sCompressorRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>(); private static Map<IRecipeInput, RecipeOutput> sCompressorRecipes = new /*Concurrent*/HashMap<IRecipeInput, RecipeOutput>();
@ -1810,14 +1812,15 @@ public class GT_ModHandler {
/** /**
* Uses a Soldering Iron * Uses a Soldering Iron
*/ */
public static boolean useSolderingIron(ItemStack aStack, EntityLivingBase aPlayer) { public static boolean useSolderingIron(ItemStack aStack, EntityLivingBase aPlayer, IInventory aExternalInventory) {
if (aPlayer == null || aStack == null) return false; if (aPlayer == null || aStack == null) return false;
if (GT_Utility.isStackInList(aStack, GregTech_API.sSolderingToolList)) { if (GT_Utility.isStackInList(aStack, GregTech_API.sSolderingToolList)) {
if (aPlayer instanceof EntityPlayer) { if (aPlayer instanceof EntityPlayer) {
EntityPlayer tPlayer = (EntityPlayer) aPlayer; EntityPlayer tPlayer = (EntityPlayer) aPlayer;
if (tPlayer.capabilities.isCreativeMode) return true; if (tPlayer.capabilities.isCreativeMode) return true;
if (isElectricItem(aStack) && ic2.api.item.ElectricItem.manager.getCharge(aStack) > 1000.0d) { if (isElectricItem(aStack) && ic2.api.item.ElectricItem.manager.getCharge(aStack) > 1000.0d) {
if (consumeSolderingMaterial(tPlayer)) { if (consumeSolderingMaterial(tPlayer)
|| (aExternalInventory != null && consumeSolderingMaterial(aExternalInventory))) {
if (canUseElectricItem(aStack, 10000)) { if (canUseElectricItem(aStack, 10000)) {
return GT_ModHandler.useElectricItem(aStack, 10000, (EntityPlayer) aPlayer); return GT_ModHandler.useElectricItem(aStack, 10000, (EntityPlayer) aPlayer);
} }
@ -1836,17 +1839,37 @@ public class GT_ModHandler {
/** /**
* Simply consumes some soldering material * Simply consumes some soldering material
*/ */
public static boolean useSolderingIron(ItemStack aStack, EntityLivingBase aPlayer) {
return useSolderingIron(aStack, aPlayer, null);
}
public static boolean consumeSolderingMaterial(EntityPlayer aPlayer) { public static boolean consumeSolderingMaterial(EntityPlayer aPlayer) {
if (aPlayer.capabilities.isCreativeMode) return true; if (aPlayer.capabilities.isCreativeMode) return true;
for (int i = 0; i < aPlayer.inventory.mainInventory.length; i++) { if (consumeSolderingMaterial(aPlayer.inventory)) {
if (GT_Utility.isStackInList(aPlayer.inventory.mainInventory[i], GregTech_API.sSolderingMetalList)) { if (aPlayer.inventoryContainer != null) {
if (aPlayer.inventory.mainInventory[i].stackSize < 1) return false; aPlayer.inventoryContainer.detectAndSendChanges();
if (aPlayer.inventory.mainInventory[i].stackSize == 1) {
aPlayer.inventory.mainInventory[i] = null;
} else {
aPlayer.inventory.mainInventory[i].stackSize--;
} }
if (aPlayer.inventoryContainer != null) aPlayer.inventoryContainer.detectAndSendChanges(); return true;
}
return false;
}
/**
* Consumes soldering material from given inventory
*/
public static boolean consumeSolderingMaterial(IInventory aInventory) {
for (int i = 0; i < aInventory.getSizeInventory(); i++) {
ItemStack tStack = aInventory.getStackInSlot(i);
if (GT_Utility.isStackInList(tStack, GregTech_API.sSolderingMetalList)) {
if (tStack.stackSize < 1) return false;
if (tStack.stackSize == 1) {
tStack = null;
} else {
tStack.stackSize--;
}
aInventory.setInventorySlotContents(i, tStack);
aInventory.markDirty();
return true; return true;
} }
} }
@ -1882,8 +1905,17 @@ public class GT_ModHandler {
return false; return false;
} }
/**
* Allow item to be inserted into ic2 toolbox
*/
public static void registerBoxableItemToToolBox(ItemStack aStack) { public static void registerBoxableItemToToolBox(ItemStack aStack) {
if (aStack != null) registerBoxableItemToToolBox(aStack.getItem()); if (aStack != null) {
try {
ic2.api.item.ItemWrapper.registerBoxable(aStack.getItem(), (IBoxable) sBoxableWrapper);
} catch (Throwable ignored) {/*Do nothing*/}
sBoxableItems.add(new GT_ItemStack(aStack));
}
} }
public static void registerBoxableItemToToolBox(Item aItem) { public static void registerBoxableItemToToolBox(Item aItem) {