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:
parent
58d11dfbdc
commit
93d7efcb40
6 changed files with 45 additions and 31 deletions
|
@ -5,7 +5,6 @@ import java.util.Map;
|
|||
import javax.annotation.Nonnull;
|
||||
|
||||
import mezz.jei.api.*;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
|
@ -90,6 +89,6 @@ public class BloodMagicPlugin extends BlankModPlugin
|
|||
|
||||
@Override
|
||||
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
|
||||
subtypeRegistry.useNbtForSubtypes(Item.getItemFromBlock(ModBlocks.BLOOD_TANK));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue