47 lines
1.2 KiB
Java
47 lines
1.2 KiB
Java
package ley.modding.dartcraft.tile;
|
|
|
|
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 TileEntityStairs extends TileEntity {
|
|
public int color;
|
|
|
|
@Override
|
|
public boolean canUpdate() {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public Packet getDescriptionPacket() {
|
|
NBTTagCompound nbt = new NBTTagCompound();
|
|
|
|
this.writeToNBT(nbt);
|
|
|
|
return new S35PacketUpdateTileEntity(
|
|
this.xCoord, this.yCoord, this.zCoord, this.getBlockMetadata(), nbt
|
|
);
|
|
}
|
|
|
|
@Override
|
|
public void onDataPacket(NetworkManager nm, S35PacketUpdateTileEntity pkt) {
|
|
this.readFromNBT(pkt.func_148857_g());
|
|
}
|
|
|
|
@Override
|
|
public void readFromNBT(NBTTagCompound comp) {
|
|
super.readFromNBT(comp);
|
|
if (comp.hasKey("color")) {
|
|
this.color = comp.getInteger("color");
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void writeToNBT(NBTTagCompound comp) {
|
|
super.writeToNBT(comp);
|
|
comp.setInteger("color", this.color);
|
|
}
|
|
}
|