mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Cleanup~
This commit is contained in:
parent
2c763c9199
commit
3278cf9d3f
16 changed files with 94 additions and 95 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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(){
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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){
|
||||
|
|
Loading…
Reference in a new issue