aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/metatileentity
diff options
context:
space:
mode:
authorAndrew Ozmitel <andrew@ozmitel.ru>2016-12-28 20:03:05 +0300
committerAndrew Ozmitel <andrew@ozmitel.ru>2016-12-28 20:03:05 +0300
commit674a2aec839d1f9e93f02b75d5002fd4364f470a (patch)
tree84b78102be5b12147824e24cb8bc26b00bc4f3e8 /src/main/java/gregtech/api/metatileentity
parentc69a768640eb947b3050119e6fa0aa2e264ff32a (diff)
downloadGT5-Unofficial-674a2aec839d1f9e93f02b75d5002fd4364f470a.tar.gz
GT5-Unofficial-674a2aec839d1f9e93f02b75d5002fd4364f470a.tar.bz2
GT5-Unofficial-674a2aec839d1f9e93f02b75d5002fd4364f470a.zip
Fix Blood-Asp/GT5-Unofficial#825
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity')
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java56
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);