Check so that unnecessary code doesn't run

This commit is contained in:
Ellpeck 2015-12-15 18:52:51 +01:00
parent 99ccd4465e
commit c22ab90fdb

View file

@ -196,16 +196,19 @@ public abstract class BlockContainerBase extends BlockContainer{
if(tile instanceof IFluidSaver){ if(tile instanceof IFluidSaver){
int amount = stack.getTagCompound().getInteger("FluidAmount"); int amount = stack.getTagCompound().getInteger("FluidAmount");
FluidStack[] fluids = new FluidStack[amount];
for(int i = 0; i < amount; i++){ if(amount > 0){
NBTTagCompound compound = stack.getTagCompound().getCompoundTag("Fluid"+i); FluidStack[] fluids = new FluidStack[amount];
if(compound != null){
fluids[i] = FluidStack.loadFluidStackFromNBT(compound); for(int i = 0; i < amount; i++){
NBTTagCompound compound = stack.getTagCompound().getCompoundTag("Fluid"+i);
if(compound != null){
fluids[i] = FluidStack.loadFluidStackFromNBT(compound);
}
} }
}
((IFluidSaver)tile).setFluids(fluids); ((IFluidSaver)tile).setFluids(fluids);
}
} }
} }
} }