Files
TinkersConstruct/src/main/java/tconstruct/blocks/logic/LiquidTextureLogic.java
T

66 lines
1.5 KiB
Java

package tconstruct.blocks.logic;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.tileentity.TileEntity;
public class LiquidTextureLogic extends TileEntity
{
int texturePos;
public boolean canUpdate ()
{
return false;
}
public void setLiquidType (int tex)
{
texturePos = tex;
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
}
public int getLiquidType ()
{
return texturePos;
}
public void readFromNBT (NBTTagCompound tags)
{
super.readFromNBT(tags);
readCustomNBT(tags);
}
public void readCustomNBT (NBTTagCompound tags)
{
texturePos = tags.getInteger("Texture");
}
public void writeToNBT (NBTTagCompound tags)
{
super.writeToNBT(tags);
writeCustomNBT(tags);
}
public void writeCustomNBT (NBTTagCompound tags)
{
tags.setInteger("Texture", texturePos);
}
@Override
public Packet getDescriptionPacket ()
{
NBTTagCompound tag = new NBTTagCompound();
writeCustomNBT(tag);
return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, tag);
}
@Override
public void onDataPacket (INetworkManager net, Packet132TileEntityData packet)
{
readCustomNBT(packet.data);
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
}
}