This commit is contained in:
Raoul Van den Berge
2016-05-23 22:15:26 +02:00
parent 3fba8ba174
commit 1e418c6a2f
5 changed files with 26 additions and 28 deletions

View File

@@ -63,26 +63,24 @@ public abstract class TileBase extends TileEntity implements ITickable {
return super.writeToNBT(nbt); return super.writeToNBT(nbt);
} }
public void writeToDescriptionPacketNBT(NBTTagCompound tag) { public NBTTagCompound writeToUpdatePacketNBT(NBTTagCompound tag) {
tag.setInteger(NBT_DIRECTION, direction.ordinal()); tag.setInteger(NBT_DIRECTION, direction.ordinal());
return tag;
} }
public void readFromDescriptionPacketNBT(NBTTagCompound tag) { public void readFromUpdatePacketNBT(NBTTagCompound tag) {
direction = EnumFacing.getFront(tag.getInteger(NBT_DIRECTION)); direction = EnumFacing.getFront(tag.getInteger(NBT_DIRECTION));
} }
@Override @Override
public SPacketUpdateTileEntity getUpdatePacket() { public SPacketUpdateTileEntity getUpdatePacket() {
NBTTagCompound nbt = new NBTTagCompound(); return new SPacketUpdateTileEntity(pos, 1, writeToUpdatePacketNBT(new NBTTagCompound()));
writeToDescriptionPacketNBT(nbt);
return new SPacketUpdateTileEntity(pos, 1, nbt);
} }
@Override @Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) { public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
readFromDescriptionPacketNBT(packet.getNbtCompound()); readFromUpdatePacketNBT(packet.getNbtCompound());
RefinedStorageUtils.updateBlock(worldObj, pos); RefinedStorageUtils.updateBlock(worldObj, pos);
} }

View File

@@ -545,15 +545,15 @@ public class TileController extends TileBase implements IEnergyReceiver, ISynchr
} }
@Override @Override
public void writeToDescriptionPacketNBT(NBTTagCompound tag) { public NBTTagCompound writeToUpdatePacketNBT(NBTTagCompound tag) {
super.writeToDescriptionPacketNBT(tag);
tag.setInteger(NBT_DESC_ENERGY, getEnergyStored(null)); tag.setInteger(NBT_DESC_ENERGY, getEnergyStored(null));
return super.writeToUpdatePacketNBT(tag);
} }
@Override @Override
public void readFromDescriptionPacketNBT(NBTTagCompound tag) { public void readFromUpdatePacketNBT(NBTTagCompound tag) {
super.readFromDescriptionPacketNBT(tag); super.readFromUpdatePacketNBT(tag);
setEnergyStored(tag.getInteger(NBT_DESC_ENERGY)); setEnergyStored(tag.getInteger(NBT_DESC_ENERGY));
} }

View File

@@ -166,17 +166,17 @@ public class TileDetector extends TileMachine implements ICompareConfig {
} }
@Override @Override
public void readFromDescriptionPacketNBT(NBTTagCompound tag) { public void readFromUpdatePacketNBT(NBTTagCompound tag) {
super.readFromDescriptionPacketNBT(tag); super.readFromUpdatePacketNBT(tag);
powered = tag.getBoolean(NBT_DESC_POWERED); powered = tag.getBoolean(NBT_DESC_POWERED);
} }
@Override @Override
public void writeToDescriptionPacketNBT(NBTTagCompound tag) { public NBTTagCompound writeToUpdatePacketNBT(NBTTagCompound tag) {
super.writeToDescriptionPacketNBT(tag);
tag.setBoolean(NBT_DESC_POWERED, powered); tag.setBoolean(NBT_DESC_POWERED, powered);
return super.writeToUpdatePacketNBT(tag);
} }
@Override @Override

View File

@@ -156,14 +156,14 @@ public abstract class TileMachine extends TileBase implements ISynchronizedConta
return super.writeToNBT(nbt); return super.writeToNBT(nbt);
} }
public void writeToDescriptionPacketNBT(NBTTagCompound tag) { public NBTTagCompound writeToUpdatePacketNBT(NBTTagCompound tag) {
super.writeToDescriptionPacketNBT(tag);
tag.setBoolean(NBT_DESC_CONNECTED, isActive()); tag.setBoolean(NBT_DESC_CONNECTED, isActive());
return super.writeToUpdatePacketNBT(tag);
} }
public void readFromDescriptionPacketNBT(NBTTagCompound tag) { public void readFromUpdatePacketNBT(NBTTagCompound tag) {
super.readFromDescriptionPacketNBT(tag); super.readFromUpdatePacketNBT(tag);
connected = tag.getBoolean(NBT_DESC_CONNECTED); connected = tag.getBoolean(NBT_DESC_CONNECTED);
} }

View File

@@ -124,15 +124,15 @@ public class TileSolderer extends TileMachine {
} }
@Override @Override
public void writeToDescriptionPacketNBT(NBTTagCompound tag) { public NBTTagCompound writeToUpdatePacketNBT(NBTTagCompound tag) {
super.writeToDescriptionPacketNBT(tag);
tag.setBoolean(NBT_WORKING, working); tag.setBoolean(NBT_WORKING, working);
return super.writeToUpdatePacketNBT(tag);
} }
@Override @Override
public void readFromDescriptionPacketNBT(NBTTagCompound tag) { public void readFromUpdatePacketNBT(NBTTagCompound tag) {
super.readFromDescriptionPacketNBT(tag); super.readFromUpdatePacketNBT(tag);
working = tag.getBoolean(NBT_WORKING); working = tag.getBoolean(NBT_WORKING);
} }