Fix crash when creating a tank stack with meta > 15 (#1057)

Also finally fixes the tanks so they properly drop themselves.
This commit is contained in:
Nicholas Ignoffo 2017-02-20 13:47:36 -08:00
parent 58d11dfbdc
commit 93d7efcb40
6 changed files with 45 additions and 31 deletions

View file

@ -44,16 +44,15 @@ public class DataProviderBloodTank implements IWailaDataProvider
{
TileBloodTank bloodTank = (TileBloodTank) accessor.getTileEntity();
NBTTagCompound tag = accessor.getNBTData();
int capacity = tag.getInteger(Constants.NBT.ALTAR_CAPACITY);
int capacity = accessor.getNBTData().getInteger(Constants.NBT.ALTAR_CAPACITY);
currenttip.add(TextHelper.localizeEffect("tooltip.bloodmagic.tier", bloodTank.getBlockMetadata() + 1));
currenttip.add(TextHelper.localizeEffect("tooltip.bloodmagic.fluid.capacity") + ": " + capacity + "mB");
currenttip.add(TextHelper.localizeEffect("tooltip.bloodmagic.fluid.capacity", capacity));
tag = tag.getCompoundTag(Constants.NBT.TANK);
FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(tag);
if (!Strings.isNullOrEmpty(tag.getString("FluidName")) && fluidStack != null)
FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(tag.getCompoundTag(Constants.NBT.TANK));
if (fluidStack != null)
{
currenttip.add(TextHelper.localizeEffect("tooltip.bloodmagic.fluid.type") + ": " + fluidStack.getLocalizedName());
currenttip.add(TextHelper.localizeEffect("tooltip.bloodmagic.fluid.amount") + ": " + tag.getInteger("Amount") + "/" + capacity + "mB");
currenttip.add(TextHelper.localizeEffect("tooltip.bloodmagic.fluid.type", fluidStack.getLocalizedName()));
currenttip.add(TextHelper.localizeEffect("tooltip.bloodmagic.fluid.amount", fluidStack.amount, capacity));
}
}
}