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.SPacketUpdateTileEntity;
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 tagCompound)
{
super.readFromNBT(tagCompound);
this.message = tagCompound.getString("message");
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
{
super.writeToNBT(tagCompound);
if(this.message != null)
{
tagCompound.setString("message", this.message);
}
return tagCompound;
}
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt)
{
this.readFromNBT(pkt.getNbtCompound());
}
@Override
public SPacketUpdateTileEntity getUpdatePacket()
{
return new SPacketUpdateTileEntity(pos, getBlockMetadata(), this.writeToNBT(new NBTTagCompound()));
}
@Override
public NBTTagCompound getUpdateTag()
{
return this.writeToNBT(new NBTTagCompound());
}
}