Clean up TE implementations

Offload some work to base classes that provide some helpers

TODO: Implementations for Inventories (using caps) and ticking tiles with inventories.
This commit is contained in:
Nicholas Ignoffo 2016-09-07 17:46:06 -07:00
parent 4d331aa758
commit 798bad5583
23 changed files with 280 additions and 493 deletions

View file

@ -40,9 +40,9 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
}
@Override
public void readFromNBT(NBTTagCompound tagCompound)
public void deserialize(NBTTagCompound tagCompound)
{
super.readFromNBT(tagCompound);
super.deserialize(tagCompound);
this.isActive = tagCompound.getBoolean("isActive");
this.activeCounter = tagCompound.getInteger("activeCounter");
this.key = tagCompound.getString("key");
@ -57,9 +57,9 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
public NBTTagCompound serialize(NBTTagCompound tagCompound)
{
super.writeToNBT(tagCompound);
super.serialize(tagCompound);
tagCompound.setBoolean("isActive", isActive);
tagCompound.setInteger("activeCounter", activeCounter);
tagCompound.setString("key", "".equals(key) ? "empty" : key);
@ -153,19 +153,4 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
return false;
}
@Override
public SPacketUpdateTileEntity getUpdatePacket()
{
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeToNBT(nbttagcompound);
return new SPacketUpdateTileEntity(pos, this.getBlockMetadata(), nbttagcompound);
}
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet)
{
super.onDataPacket(net, packet);
readFromNBT(packet.getNbtCompound());
}
}