Inital port to tile based meta

This commit is contained in:
Modmuss50 2015-09-05 09:17:58 +01:00
parent 2c863d9e11
commit d3e860edb2
34 changed files with 198 additions and 246 deletions

View file

@ -13,6 +13,8 @@ import java.util.List;
public abstract class TileMachineBase extends TileEntity {
int meta;
public void syncWithAll() {
if (!worldObj.isRemote) {
PacketHandler.sendPacketToAllPlayers(getDescriptionPacket(),
@ -39,4 +41,27 @@ public abstract class TileMachineBase extends TileEntity {
readFromNBT(packet.func_148857_g());
}
public int getMeta() {
return meta;
}
public void setMeta(int meta) {
this.meta = meta;
syncWithAll();
worldObj.notifyBlockChange(xCoord, yCoord, zCoord, blockType);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
}
@Override
public void readFromNBT(NBTTagCompound tagCompound) {
super.readFromNBT(tagCompound);
meta = tagCompound.getInteger("meta");
}
@Override
public void writeToNBT(NBTTagCompound tagCompound) {
super.writeToNBT(tagCompound);
tagCompound.setInteger("meta", meta);
}
}