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);
}
public void writeToDescriptionPacketNBT(NBTTagCompound tag) {
public NBTTagCompound writeToUpdatePacketNBT(NBTTagCompound tag) {
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));
}
@Override
public SPacketUpdateTileEntity getUpdatePacket() {
NBTTagCompound nbt = new NBTTagCompound();
writeToDescriptionPacketNBT(nbt);
return new SPacketUpdateTileEntity(pos, 1, nbt);
return new SPacketUpdateTileEntity(pos, 1, writeToUpdatePacketNBT(new NBTTagCompound()));
}
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
readFromDescriptionPacketNBT(packet.getNbtCompound());
readFromUpdatePacketNBT(packet.getNbtCompound());
RefinedStorageUtils.updateBlock(worldObj, pos);
}

View File

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

View File

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

View File

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

View File

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