diff options
author | Blood-Asp <bloodasphendrik@gmail.com> | 2017-01-04 16:42:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-04 16:42:25 +0100 |
commit | b794aac1d0bbb92ebef1fe278181c7a9528e2fe2 (patch) | |
tree | 09d19fb2bf2bd90e706822edce68c99bab172c8d /src/main/java/gregtech/api | |
parent | 868fe1f77db6cc02b6240d97482592f28d3f92ff (diff) | |
parent | e7e48ff2156134c59625dcb0a121ae804d3b31b1 (diff) | |
download | GT5-Unofficial-b794aac1d0bbb92ebef1fe278181c7a9528e2fe2.tar.gz GT5-Unofficial-b794aac1d0bbb92ebef1fe278181c7a9528e2fe2.tar.bz2 GT5-Unofficial-b794aac1d0bbb92ebef1fe278181c7a9528e2fe2.zip |
Merge pull request #827 from KpoxaPy/unstable
Fix #825
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r-- | src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 367ae25bac..b0aac0bc7e 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -116,18 +116,24 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { aNBT.setInteger("mPollution", mPollution); aNBT.setInteger("mRuntime", mRuntime); - if (mOutputItems != null) for (int i = 0; i < mOutputItems.length; i++) - if (mOutputItems[i] != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - mOutputItems[i].writeToNBT(tNBT); - aNBT.setTag("mOutputItem" + i, tNBT); - } - if (mOutputFluids != null) for (int i = 0; i < mOutputFluids.length; i++) - if (mOutputFluids[i] != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - mOutputFluids[i].writeToNBT(tNBT); - aNBT.setTag("mOutputFluids" + i, tNBT); - } + if (mOutputItems != null) { + aNBT.setInteger("mOutputItemsLength", mOutputItems.length); + for (int i = 0; i < mOutputItems.length; i++) + if (mOutputItems[i] != null) { + NBTTagCompound tNBT = new NBTTagCompound(); + mOutputItems[i].writeToNBT(tNBT); + aNBT.setTag("mOutputItem" + i, tNBT); + } + } + if (mOutputFluids != null) { + aNBT.setInteger("mOutputFluidsLength", mOutputFluids.length); + for (int i = 0; i < mOutputFluids.length; i++) + if (mOutputFluids[i] != null) { + NBTTagCompound tNBT = new NBTTagCompound(); + mOutputFluids[i].writeToNBT(tNBT); + aNBT.setTag("mOutputFluids" + i, tNBT); + } + } aNBT.setBoolean("mWrench", mWrench); aNBT.setBoolean("mScrewdriver", mScrewdriver); aNBT.setBoolean("mSoftHammer", mSoftHammer); @@ -146,11 +152,21 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { mEfficiency = aNBT.getInteger("mEfficiency"); mPollution = aNBT.getInteger("mPollution"); mRuntime = aNBT.getInteger("mRuntime"); - mOutputItems = new ItemStack[getAmountOfOutputs()]; - for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); - mOutputFluids = new FluidStack[getAmountOfOutputs()]; - for (int i = 0; i < mOutputFluids.length; i++) - mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); + + int aOutputItemsLength = aNBT.getInteger("mOutputItemsLength"); + if (aOutputItemsLength > 0) { + mOutputItems = new ItemStack[aOutputItemsLength]; + for (int i = 0; i < mOutputItems.length; i++) + mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); + } + + int aOutputFluidsLength = aNBT.getInteger("mOutputFluidsLength"); + if (aOutputFluidsLength > 0) { + mOutputFluids = new FluidStack[aOutputFluidsLength]; + for (int i = 0; i < mOutputFluids.length; i++) + mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); + } + mWrench = aNBT.getBoolean("mWrench"); mScrewdriver = aNBT.getBoolean("mScrewdriver"); mSoftHammer = aNBT.getBoolean("mSoftHammer"); @@ -351,12 +367,6 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { public abstract int getDamageToComponent(ItemStack aStack); /** - * Gets the Amount of possibly outputted Items for loading the Output Stack Array from NBT. - * This should be the largest Amount that can ever happen legitimately. - */ - public abstract int getAmountOfOutputs(); - - /** * If it explodes when the Component has to be replaced. */ public abstract boolean explodesOnComponentBreak(ItemStack aStack); |