mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 04:09:40 +00:00
46 lines
1.3 KiB
Java
46 lines
1.3 KiB
Java
package tconstruct.items.blocks;
|
|
|
|
import java.util.List;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.item.ItemBlock;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
import net.minecraft.util.MathHelper;
|
|
|
|
public class LavaTankItemBlock extends ItemBlock
|
|
{
|
|
public static final String blockType[] = { "Tank", "Gague", "Window" };
|
|
|
|
public LavaTankItemBlock(int id)
|
|
{
|
|
super(id);
|
|
setMaxDamage(0);
|
|
setHasSubtypes(true);
|
|
}
|
|
|
|
public int getMetadata (int meta)
|
|
{
|
|
return meta;
|
|
}
|
|
|
|
public String getUnlocalizedName (ItemStack itemstack)
|
|
{
|
|
int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1);
|
|
return (new StringBuilder()).append("LavaTank.").append(blockType[pos]).toString();
|
|
}
|
|
|
|
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
|
{
|
|
if (stack.hasTagCompound())
|
|
{
|
|
NBTTagCompound liquidTag = stack.getTagCompound().getCompoundTag("Fluid");
|
|
if (liquidTag != null)
|
|
{
|
|
list.add("Contains " + liquidTag.getString("FluidName"));
|
|
list.add(liquidTag.getInteger("Amount") + " mB");
|
|
}
|
|
}
|
|
}
|
|
}
|