diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java index ecb45ca04..a12515582 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java @@ -359,7 +359,7 @@ public class GuiBooklet extends GuiScreen{ this.currentChapter = null; this.currentIndexEntry = null; - //So that the First Page will still open if used via something like NEI before + //So that the First Page will still open if used via something like NEI before if(this.parentScreen == null && !PersistentClientData.getBoolean("BookAlreadyOpened")){ this.openIndexEntry(InitBooklet.chapterIntro.entry, 1, true); this.openChapter(InitBooklet.chapterIntro, null); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java index 1faeb7cdc..195f9b7c4 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java @@ -76,8 +76,6 @@ public abstract class TileEntityBase extends TileEntity{ this.writeSyncableNBT(compound, false); } - public abstract void readSyncableNBT(NBTTagCompound compound, boolean isForSync); - public abstract void writeSyncableNBT(NBTTagCompound compound, boolean isForSync); @Override @@ -97,6 +95,8 @@ public abstract class TileEntityBase extends TileEntity{ return !(oldBlock.isAssociatedBlock(newBlock)); } + public abstract void readSyncableNBT(NBTTagCompound compound, boolean isForSync); + protected void sendUpdate(){ this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDirectionalBreaker.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDirectionalBreaker.java index b2631cc68..0b912a9ef 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDirectionalBreaker.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDirectionalBreaker.java @@ -88,13 +88,6 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored(); } - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.storage.readFromNBT(compound); - this.currentTime = compound.getInteger("CurrentTime"); - } - @Override public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ super.writeSyncableNBT(compound, sync); @@ -102,6 +95,13 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem compound.setInteger("CurrentTime", this.currentTime); } + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.storage.readFromNBT(compound); + this.currentTime = compound.getInteger("CurrentTime"); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return false; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFermentingBarrel.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFermentingBarrel.java index 5aa44eb7f..4a6580442 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFermentingBarrel.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFermentingBarrel.java @@ -79,14 +79,6 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen return this.currentProcessTime*i/ConfigIntValues.BARREL_PROCESSING_TIME.getValue(); } - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - this.currentProcessTime = compound.getInteger("ProcessTime"); - this.canolaTank.readFromNBT(compound); - this.oilTank.readFromNBT((NBTTagCompound)compound.getTag("OilTank")); - super.readSyncableNBT(compound, sync); - } - @Override public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ compound.setInteger("ProcessTime", this.currentProcessTime); @@ -97,6 +89,14 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen super.writeSyncableNBT(compound, sync); } + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + this.currentProcessTime = compound.getInteger("ProcessTime"); + this.canolaTank.readFromNBT(compound); + this.oilTank.readFromNBT((NBTTagCompound)compound.getTag("OilTank")); + super.readSyncableNBT(compound, sync); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return (i == 0 && FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidCanolaOil, FluidContainerRegistry.BUCKET_VOLUME))) || (i == 2 && stack.getItem() == Items.bucket); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFishingNet.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFishingNet.java index 0c46ac9ba..62c76d26f 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFishingNet.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFishingNet.java @@ -28,14 +28,13 @@ public class TileEntityFishingNet extends TileEntityBase{ public int timeUntilNextDrop; @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - this.timeUntilNextDrop = compound.getInteger("TimeUntilNextDrop"); + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + compound.setInteger("TimeUntilNextDrop", this.timeUntilNextDrop); } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeToNBT(compound); - compound.setInteger("TimeUntilNextDrop", this.timeUntilNextDrop); + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + this.timeUntilNextDrop = compound.getInteger("TimeUntilNextDrop"); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFluidCollector.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFluidCollector.java index 815e6d294..4e5517a78 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFluidCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFluidCollector.java @@ -158,13 +158,6 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements return this.tank.getFluidAmount()*i/this.tank.getCapacity(); } - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.currentTime = compound.getInteger("CurrentTime"); - this.tank.readFromNBT(compound); - } - @Override public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ super.writeSyncableNBT(compound, sync); @@ -172,6 +165,13 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements this.tank.writeToNBT(compound); } + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.currentTime = compound.getInteger("CurrentTime"); + this.tank.readFromNBT(compound); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ if(i == 0){ diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java index fe68c9475..5ddb0c4e2 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceSolar.java @@ -42,13 +42,13 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro } @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - this.storage.readFromNBT(compound); + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + this.storage.writeToNBT(compound); } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - this.storage.writeToNBT(compound); + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + this.storage.readFromNBT(compound); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGreenhouseGlass.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGreenhouseGlass.java index 26d05b769..b314bd10f 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGreenhouseGlass.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGreenhouseGlass.java @@ -64,13 +64,13 @@ public class TileEntityGreenhouseGlass extends TileEntityBase{ return null; } - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){ - compound.setInteger("Time", this.timeUntilNextFert); - } - @Override public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){ this.timeUntilNextFert = compound.getInteger("Time"); } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){ + compound.setInteger("Time", this.timeUntilNextFert); + } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityHeatCollector.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityHeatCollector.java index 3fd506d92..ef04e01b0 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityHeatCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityHeatCollector.java @@ -79,13 +79,13 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr return from == ForgeDirection.UP; } - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){ - this.storage.readFromNBT(compound); - } - @Override public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){ this.storage.writeToNBT(compound); } + + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){ + this.storage.readFromNBT(compound); + } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java index 068698e91..71aaaec0a 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java @@ -31,22 +31,6 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements this.slots = new ItemStack[itemAmount]; } - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){ - if(!isForSync){ - if(this.slots.length > 0){ - NBTTagList tagList = compound.getTagList("Items", 10); - for(int i = 0; i < tagList.tagCount(); i++){ - NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); - byte slotIndex = tagCompound.getByte("Slot"); - if(slotIndex >= 0 && slotIndex < slots.length){ - slots[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound); - } - } - } - } - } - @Override public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){ if(!isForSync){ @@ -65,6 +49,22 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements } } + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){ + if(!isForSync){ + if(this.slots.length > 0){ + NBTTagList tagList = compound.getTagList("Items", 10); + for(int i = 0; i < tagList.tagCount(); i++){ + NBTTagCompound tagCompound = tagList.getCompoundTagAt(i); + byte slotIndex = tagCompound.getByte("Slot"); + if(slotIndex >= 0 && slotIndex < slots.length){ + slots[slotIndex] = ItemStack.loadItemStackFromNBT(tagCompound); + } + } + } + } + } + @Override public int[] getAccessibleSlotsFromSide(int side){ if(this.slots.length > 0){ diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityLavaFactoryController.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityLavaFactoryController.java index e0059f616..874e2a725 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityLavaFactoryController.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityLavaFactoryController.java @@ -30,18 +30,18 @@ public class TileEntityLavaFactoryController extends TileEntityBase implements I public EnergyStorage storage = new EnergyStorage(3000000); private int currentWorkTime; - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - this.storage.readFromNBT(compound); - this.currentWorkTime = compound.getInteger("WorkTime"); - } - @Override public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ this.storage.writeToNBT(compound); compound.setInteger("WorkTime", this.currentWorkTime); } + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + this.storage.readFromNBT(compound); + this.currentWorkTime = compound.getInteger("WorkTime"); + } + @Override @SuppressWarnings("unchecked") public void updateEntity(){ diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityLeafGenerator.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityLeafGenerator.java index 4d0f5623c..2f0af50c4 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityLeafGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityLeafGenerator.java @@ -29,13 +29,13 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr private int nextUseCounter; @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - this.storage.readFromNBT(compound); + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + this.storage.writeToNBT(compound); } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - this.storage.writeToNBT(compound); + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + this.storage.readFromNBT(compound); } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomBooster.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomBooster.java index 473756527..fc34ec51e 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomBooster.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomBooster.java @@ -20,12 +20,12 @@ public class TileEntityPhantomBooster extends TileEntityBase{ } @Override - public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){ + public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){ } @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean isForSync){ + public void readSyncableNBT(NBTTagCompound compound, boolean isForSync){ } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlacer.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlacer.java index 260509f07..2997a3fe4 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlacer.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomPlacer.java @@ -137,6 +137,18 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements return this.range; } + @Override + public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ + super.writeSyncableNBT(compound, sync); + compound.setInteger("Time", currentTime); + if(this.hasBoundPosition()){ + compound.setInteger("XCoordOfTileStored", boundPosition.getX()); + compound.setInteger("YCoordOfTileStored", boundPosition.getY()); + compound.setInteger("ZCoordOfTileStored", boundPosition.getZ()); + compound.setInteger("WorldOfTileStored", boundPosition.getWorld().provider.dimensionId); + } + } + @Override public void readSyncableNBT(NBTTagCompound compound, boolean sync){ super.readSyncableNBT(compound, sync); @@ -150,18 +162,6 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements } } - @Override - public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ - super.writeSyncableNBT(compound, sync); - compound.setInteger("Time", currentTime); - if(this.hasBoundPosition()){ - compound.setInteger("XCoordOfTileStored", boundPosition.getX()); - compound.setInteger("YCoordOfTileStored", boundPosition.getY()); - compound.setInteger("ZCoordOfTileStored", boundPosition.getZ()); - compound.setInteger("WorldOfTileStored", boundPosition.getWorld().provider.dimensionId); - } - } - @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return !this.isBreaker; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityRangedCollector.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityRangedCollector.java index 2f1b643e4..0f6eb5f4d 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityRangedCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityRangedCollector.java @@ -74,18 +74,18 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement return !this.isWhitelist; } - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - super.readSyncableNBT(compound, sync); - this.isWhitelist = compound.getBoolean("Whitelist"); - } - @Override public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ super.writeSyncableNBT(compound, sync); compound.setBoolean("Whitelist", this.isWhitelist); } + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + super.readSyncableNBT(compound, sync); + this.isWhitelist = compound.getBoolean("Whitelist"); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return false; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntitySmileyCloud.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntitySmileyCloud.java index 6ff00943e..051600dcf 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntitySmileyCloud.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntitySmileyCloud.java @@ -27,11 +27,6 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac public int flyHeight; private String nameBefore; - @Override - public void readSyncableNBT(NBTTagCompound compound, boolean sync){ - this.name = compound.getString("Name"); - } - @Override public void writeSyncableNBT(NBTTagCompound compound, boolean sync){ if(this.name != null){ @@ -39,6 +34,11 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac } } + @Override + public void readSyncableNBT(NBTTagCompound compound, boolean sync){ + this.name = compound.getString("Name"); + } + @Override public void updateEntity(){ if(!worldObj.isRemote){