Maybe fixed a bug caused by desync that would cause blocks to have ridiculous amounts of energy/luqiuid

This commit is contained in:
Ellpeck 2016-01-09 17:30:24 +01:00
parent 61b921b2dd
commit 0d00143298

View file

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