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

@ -47,9 +47,9 @@ public class TileFilteredRoutingNode extends TileRoutingNode implements ISidedIn
}
@Override
public void readFromNBT(NBTTagCompound tag)
public void deserialize(NBTTagCompound tag)
{
super.readFromNBT(tag);
super.deserialize(tag);
currentActiveSlot = tag.getInteger("currentSlot");
priorities = tag.getIntArray(Constants.NBT.ROUTING_PRIORITY);
if (priorities.length != 6)
@ -83,9 +83,9 @@ public class TileFilteredRoutingNode extends TileRoutingNode implements ISidedIn
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tag)
public NBTTagCompound serialize(NBTTagCompound tag)
{
super.writeToNBT(tag);
super.serialize(tag);
tag.setInteger("currentSlot", currentActiveSlot);
tag.setIntArray(Constants.NBT.ROUTING_PRIORITY, priorities);
tag.setBoolean("updated", true);

View file

@ -155,10 +155,9 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tag)
public NBTTagCompound serialize(NBTTagCompound tag)
{
super.writeToNBT(tag);
super.serialize(tag);
NBTTagList tags = new NBTTagList();
for (BlockPos pos : generalNodeList)
{
@ -195,9 +194,9 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
}
@Override
public void readFromNBT(NBTTagCompound tag)
public void deserialize(NBTTagCompound tag)
{
super.readFromNBT(tag);
super.deserialize(tag);
NBTTagList tags = tag.getTagList(Constants.NBT.ROUTING_MASTER_GENERAL, 10);
for (int i = 0; i < tags.tagCount(); i++)

View file

@ -41,9 +41,9 @@ public class TileRoutingNode extends TileInventory implements IRoutingNode, IIte
private List<BlockPos> connectionList = new LinkedList<BlockPos>();
@Override
public NBTTagCompound writeToNBT(NBTTagCompound tag)
public NBTTagCompound serialize(NBTTagCompound tag)
{
super.writeToNBT(tag);
super.deserialize(tag);
NBTTagCompound masterTag = new NBTTagCompound();
masterTag.setInteger(Constants.NBT.X_COORD, masterPos.getX());
masterTag.setInteger(Constants.NBT.Y_COORD, masterPos.getY());
@ -64,9 +64,9 @@ public class TileRoutingNode extends TileInventory implements IRoutingNode, IIte
}
@Override
public void readFromNBT(NBTTagCompound tag)
public void deserialize(NBTTagCompound tag)
{
super.readFromNBT(tag);
super.deserialize(tag);
connectionList.clear();
NBTTagCompound masterTag = tag.getCompoundTag(Constants.NBT.ROUTING_MASTER);
masterPos = new BlockPos(masterTag.getInteger(Constants.NBT.X_COORD), masterTag.getInteger(Constants.NBT.Y_COORD), masterTag.getInteger(Constants.NBT.Z_COORD));