TinkersConstruct/mods/tinker/tconstruct/logic/LiquidTextureLogic.java
2013-03-16 23:54:39 -07:00

66 lines
1.4 KiB
Java

package mods.tinker.tconstruct.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.customParam1);
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
}
}