This commit is contained in:
Andrew Ozmitel 2016-12-28 20:03:05 +03:00
parent c69a768640
commit 674a2aec83
18 changed files with 33 additions and 102 deletions

View file

@ -116,18 +116,24 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
aNBT.setInteger("mPollution", mPollution); aNBT.setInteger("mPollution", mPollution);
aNBT.setInteger("mRuntime", mRuntime); aNBT.setInteger("mRuntime", mRuntime);
if (mOutputItems != null) for (int i = 0; i < mOutputItems.length; i++) if (mOutputItems != null) {
if (mOutputItems[i] != null) { aNBT.setInteger("mOutputItemsLength", mOutputItems.length);
NBTTagCompound tNBT = new NBTTagCompound(); for (int i = 0; i < mOutputItems.length; i++)
mOutputItems[i].writeToNBT(tNBT); if (mOutputItems[i] != null) {
aNBT.setTag("mOutputItem" + i, tNBT); NBTTagCompound tNBT = new NBTTagCompound();
} mOutputItems[i].writeToNBT(tNBT);
if (mOutputFluids != null) for (int i = 0; i < mOutputFluids.length; i++) aNBT.setTag("mOutputItem" + i, tNBT);
if (mOutputFluids[i] != null) { }
NBTTagCompound tNBT = new NBTTagCompound(); }
mOutputFluids[i].writeToNBT(tNBT); if (mOutputFluids != null) {
aNBT.setTag("mOutputFluids" + i, tNBT); 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("mWrench", mWrench);
aNBT.setBoolean("mScrewdriver", mScrewdriver); aNBT.setBoolean("mScrewdriver", mScrewdriver);
aNBT.setBoolean("mSoftHammer", mSoftHammer); aNBT.setBoolean("mSoftHammer", mSoftHammer);
@ -146,11 +152,21 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
mEfficiency = aNBT.getInteger("mEfficiency"); mEfficiency = aNBT.getInteger("mEfficiency");
mPollution = aNBT.getInteger("mPollution"); mPollution = aNBT.getInteger("mPollution");
mRuntime = aNBT.getInteger("mRuntime"); mRuntime = aNBT.getInteger("mRuntime");
mOutputItems = new ItemStack[getAmountOfOutputs()];
for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i); int aOutputItemsLength = aNBT.getInteger("mOutputItemsLength");
mOutputFluids = new FluidStack[getAmountOfOutputs()]; if (aOutputItemsLength > 0) {
for (int i = 0; i < mOutputFluids.length; i++) mOutputItems = new ItemStack[aOutputItemsLength];
mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); 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"); mWrench = aNBT.getBoolean("mWrench");
mScrewdriver = aNBT.getBoolean("mScrewdriver"); mScrewdriver = aNBT.getBoolean("mScrewdriver");
mSoftHammer = aNBT.getBoolean("mSoftHammer"); mSoftHammer = aNBT.getBoolean("mSoftHammer");
@ -350,12 +366,6 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
*/ */
public abstract int getDamageToComponent(ItemStack aStack); 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. * If it explodes when the Component has to be replaced.
*/ */

View file

@ -329,11 +329,6 @@ public class GT_MetaTileEntity_AdvMiner2 extends GT_MetaTileEntity_MultiBlockBas
return 0; return 0;
} }
@Override
public int getAmountOfOutputs() {
return 0;
}
@Override @Override
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return false; return false;

View file

@ -228,11 +228,6 @@ public class GT_MetaTileEntity_AssemblyLine
public int getDamageToComponent(ItemStack aStack) { public int getDamageToComponent(ItemStack aStack) {
return 0; return 0;
} }
public int getAmountOfOutputs() {
return 2;
}
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return false; return false;
} }

View file

@ -218,10 +218,6 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_MultiBlock
return 0; return 0;
} }
public int getAmountOfOutputs() {
return 1;
}
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return false; return false;
} }

View file

@ -218,12 +218,6 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock
public int getPollutionPerTick(ItemStack aStack) { public int getPollutionPerTick(ItemStack aStack) {
return 15; return 15;
} }
@Override
public int getAmountOfOutputs() {
return 0;
}
@Override @Override
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return true; return true;

View file

@ -197,9 +197,6 @@ public class GT_MetaTileEntity_DistillationTower
return 0; return 0;
} }
public int getAmountOfOutputs() {
return 1;
}
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return false; return false;

View file

@ -229,10 +229,6 @@ public class GT_MetaTileEntity_ElectricBlastFurnace
return 0; return 0;
} }
public int getAmountOfOutputs() {
return 2;
}
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return false; return false;
} }

View file

@ -417,12 +417,6 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity
public int getDamageToComponent(ItemStack aStack) { public int getDamageToComponent(ItemStack aStack) {
return 0; return 0;
} }
@Override
public int getAmountOfOutputs() {
return 0;
}
@Override @Override
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return false; return false;

View file

@ -275,11 +275,6 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc
public int getDamageToComponent(ItemStack aStack) { public int getDamageToComponent(ItemStack aStack) {
return 0; return 0;
} }
public int getAmountOfOutputs() {
return 1;
}
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return false; return false;
} }

View file

@ -146,10 +146,6 @@ public class GT_MetaTileEntity_ImplosionCompressor
return 0; return 0;
} }
public int getAmountOfOutputs() {
return 2;
}
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return false; return false;
} }

View file

@ -233,10 +233,6 @@ public abstract class GT_MetaTileEntity_LargeBoiler
return 0; return 0;
} }
public int getAmountOfOutputs() {
return 1;
}
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return false; return false;
} }

View file

@ -188,12 +188,6 @@ public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_M
} }
return 0; return 0;
} }
@Override
public int getAmountOfOutputs() {
return 0;
}
@Override @Override
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return true; return true;

View file

@ -188,10 +188,6 @@ public class GT_MetaTileEntity_MultiFurnace
return 0; return 0;
} }
public int getAmountOfOutputs() {
return 128;
}
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return false; return false;
} }

View file

@ -231,11 +231,6 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa
return 0; return 0;
} }
@Override
public int getAmountOfOutputs() {
return 0;
}
@Override @Override
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return false; return false;

View file

@ -221,11 +221,6 @@ public class GT_MetaTileEntity_OilDrill extends GT_MetaTileEntity_MultiBlockBase
return 0; return 0;
} }
@Override
public int getAmountOfOutputs() {
return 0;
}
@Override @Override
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return false; return false;

View file

@ -313,10 +313,6 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl
return 0; return 0;
} }
public int getAmountOfOutputs() {
return 1;
}
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return false; return false;
} }

View file

@ -173,11 +173,6 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock
return 0; return 0;
} }
@Override
public int getAmountOfOutputs() {
return 0;
}
@Override @Override
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return false; return false;

View file

@ -140,10 +140,6 @@ public class GT_MetaTileEntity_VacuumFreezer
return 0; return 0;
} }
public int getAmountOfOutputs() {
return 1;
}
public boolean explodesOnComponentBreak(ItemStack aStack) { public boolean explodesOnComponentBreak(ItemStack aStack) {
return false; return false;
} }