package com.mrcrayfish.furniture.tileentity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
public class TileEntityDoorMat extends TileEntity
{
private String message = null;
public String getMessage()
{
return message;
}
public void setMessage(String message)
{
this.message = message;
}
@Override
public void readFromNBT(NBTTagCompound compound)
{
super.readFromNBT(compound);
this.message = compound.getString("message");
}
@Override
public void writeToNBT(NBTTagCompound compound)
{
super.writeToNBT(compound);
if(this.message != null)
{
compound.setString("message", this.message);
}
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
{
NBTTagCompound tagCom = pkt.getNbtCompound();
this.readFromNBT(tagCom);
}
@Override
public Packet getDescriptionPacket()
{
NBTTagCompound tagCom = new NBTTagCompound();
this.writeToNBT(tagCom);
return new S35PacketUpdateTileEntity(pos, getBlockMetadata(), tagCom);
}
}