mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Fixed TileEntities Updating less often
This commit is contained in:
parent
a6c8ea596c
commit
f4c401aa67
18 changed files with 22 additions and 35 deletions
|
@ -111,9 +111,13 @@ public abstract class TileEntityBase extends TileEntity{
|
|||
|
||||
}
|
||||
|
||||
protected void sendUpdate(){
|
||||
protected boolean trySendUpdate(){
|
||||
if(this.ticksElapsed % ConfigIntValues.TILE_ENTITY_UPDATE_INTERVAL.getValue() == 0){
|
||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -76,11 +76,10 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
|||
}
|
||||
}
|
||||
|
||||
if(this.storage.getEnergyStored() != this.lastEnergyStored || this.tank.getFluidAmount() != this.lastTankAmount | this.currentProcessTime != this.lastProcessTime){
|
||||
if((this.storage.getEnergyStored() != this.lastEnergyStored || this.tank.getFluidAmount() != this.lastTankAmount | this.currentProcessTime != this.lastProcessTime) && this.trySendUpdate()){
|
||||
this.lastEnergyStored = this.storage.getEnergyStored();
|
||||
this.lastProcessTime = this.currentProcessTime;
|
||||
this.lastTankAmount = this.tank.getFluidAmount();
|
||||
this.sendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,11 +80,10 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
|
|||
}
|
||||
}
|
||||
|
||||
if(this.storage.getEnergyStored() != this.lastEnergy || this.currentBurnTime != this.lastCurrentBurnTime || this.lastBurnTime != this.maxBurnTime){
|
||||
if((this.storage.getEnergyStored() != this.lastEnergy || this.currentBurnTime != this.lastCurrentBurnTime || this.lastBurnTime != this.maxBurnTime) && this.trySendUpdate()){
|
||||
this.lastEnergy = this.storage.getEnergyStored();
|
||||
this.lastCurrentBurnTime = this.currentBurnTime;
|
||||
this.lastBurnTime = this.currentBurnTime;
|
||||
this.sendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,12 +58,11 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
|||
this.brew();
|
||||
}
|
||||
|
||||
if(this.coffeeCacheAmount != this.lastCoffeeAmount || this.storage.getEnergyStored() != this.lastEnergy || this.tank.getFluidAmount() != this.lastTank || this.brewTime != this.lastBrewTime){
|
||||
if((this.coffeeCacheAmount != this.lastCoffeeAmount || this.storage.getEnergyStored() != this.lastEnergy || this.tank.getFluidAmount() != this.lastTank || this.brewTime != this.lastBrewTime) && this.trySendUpdate()){
|
||||
this.lastCoffeeAmount = coffeeCacheAmount;
|
||||
this.lastEnergy = this.storage.getEnergyStored();
|
||||
this.lastTank = this.tank.getFluidAmount();
|
||||
this.lastBrewTime = this.brewTime;
|
||||
this.sendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,9 +77,8 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem
|
|||
}
|
||||
}
|
||||
|
||||
if(this.storage.getEnergyStored() != this.lastEnergy){
|
||||
if(this.storage.getEnergyStored() != this.lastEnergy && this.trySendUpdate()){
|
||||
this.lastEnergy = this.storage.getEnergyStored();
|
||||
this.sendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,9 +47,8 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
|
|||
}
|
||||
}
|
||||
|
||||
if(lastEnergy != this.storage.getEnergyStored()){
|
||||
if(lastEnergy != this.storage.getEnergyStored() && this.trySendUpdate()){
|
||||
this.lastEnergy = this.storage.getEnergyStored();
|
||||
this.sendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,9 +57,8 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
|
|||
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, storage);
|
||||
}
|
||||
|
||||
if(lastEnergy != this.storage.getEnergyStored()){
|
||||
if(lastEnergy != this.storage.getEnergyStored() && this.trySendUpdate()){
|
||||
this.lastEnergy = this.storage.getEnergyStored();
|
||||
this.sendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,10 +74,9 @@ public class TileEntityFeeder extends TileEntityInventoryBase{
|
|||
this.markDirty();
|
||||
}
|
||||
|
||||
if(this.lastAnimalAmount != this.currentAnimalAmount || this.lastTimer != this.currentTimer){
|
||||
if((this.lastAnimalAmount != this.currentAnimalAmount || this.lastTimer != this.currentTimer) && this.trySendUpdate()){
|
||||
this.lastAnimalAmount = this.currentAnimalAmount;
|
||||
this.lastTimer = this.currentTimer;
|
||||
this.sendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,11 +66,10 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen
|
|||
}
|
||||
}
|
||||
|
||||
if(this.canolaTank.getFluidAmount() != this.lastCanola || this.oilTank.getFluidAmount() != this.lastOil || this.currentProcessTime != this.lastProcessTime){
|
||||
if((this.canolaTank.getFluidAmount() != this.lastCanola || this.oilTank.getFluidAmount() != this.lastOil || this.currentProcessTime != this.lastProcessTime) && this.trySendUpdate()){
|
||||
this.lastProcessTime = this.currentProcessTime;
|
||||
this.lastCanola = this.canolaTank.getFluidAmount();
|
||||
this.lastOil = this.oilTank.getFluidAmount();
|
||||
this.sendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,9 +147,8 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements
|
|||
}
|
||||
}
|
||||
|
||||
if(lastTankAmount != this.tank.getFluidAmount()){
|
||||
if(lastTankAmount != this.tank.getFluidAmount() && this.trySendUpdate()){
|
||||
lastTankAmount = this.tank.getFluidAmount();
|
||||
this.sendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,11 +92,10 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
|||
}
|
||||
}
|
||||
|
||||
if(lastEnergy != this.storage.getEnergyStored() || this.lastFirstSmelt != this.firstSmeltTime || this.lastSecondSmelt != this.secondSmeltTime){
|
||||
if((lastEnergy != this.storage.getEnergyStored() || this.lastFirstSmelt != this.firstSmeltTime || this.lastSecondSmelt != this.secondSmeltTime) && this.trySendUpdate()){
|
||||
this.lastEnergy = this.storage.getEnergyStored();
|
||||
this.lastFirstSmelt = this.firstSmeltTime;
|
||||
this.lastSecondSmelt = this.secondSmeltTime;
|
||||
this.sendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,11 +126,10 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
}
|
||||
}
|
||||
|
||||
if(lastEnergy != this.storage.getEnergyStored() || this.lastFirstCrush != this.firstCrushTime || this.lastSecondCrush != this.secondCrushTime){
|
||||
if((lastEnergy != this.storage.getEnergyStored() || this.lastFirstCrush != this.firstCrushTime || this.lastSecondCrush != this.secondCrushTime) && this.trySendUpdate()){
|
||||
this.lastEnergy = this.storage.getEnergyStored();
|
||||
this.lastFirstCrush = this.firstCrushTime;
|
||||
this.lastSecondCrush = this.secondCrushTime;
|
||||
this.sendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
|||
}
|
||||
|
||||
//Update the Client
|
||||
if(this.sideToPut != this.lastPutSide || this.sideToPull != this.lastPullSide || this.slotToPullStart != this.lastPullStart || this.slotToPullEnd != this.lastPullEnd || this.slotToPutStart != this.lastPutStart || this.slotToPutEnd != this.lastPutEnd || this.isPullWhitelist != lastPullWhite || this.isPutWhitelist != this.lastPutWhite){
|
||||
if((this.sideToPut != this.lastPutSide || this.sideToPull != this.lastPullSide || this.slotToPullStart != this.lastPullStart || this.slotToPullEnd != this.lastPullEnd || this.slotToPutStart != this.lastPutStart || this.slotToPutEnd != this.lastPutEnd || this.isPullWhitelist != lastPullWhite || this.isPutWhitelist != this.lastPutWhite) && this.trySendUpdate()){
|
||||
this.lastPutSide = this.sideToPut;
|
||||
this.lastPullSide = this.sideToPull;
|
||||
this.lastPullStart = this.slotToPullStart;
|
||||
|
@ -108,7 +108,6 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
|||
this.lastPutEnd = this.slotToPutEnd;
|
||||
this.lastPullWhite = this.isPullWhitelist;
|
||||
this.lastPutWhite = this.isPutWhitelist;
|
||||
this.sendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,9 +58,8 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
|||
this.nextRepairTick = 0;
|
||||
}
|
||||
|
||||
if(this.lastEnergy != this.storage.getEnergyStored()){
|
||||
if(this.lastEnergy != this.storage.getEnergyStored() && this.trySendUpdate()){
|
||||
this.lastEnergy = this.storage.getEnergyStored();
|
||||
this.sendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,11 +78,10 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
|
|||
}
|
||||
}
|
||||
|
||||
if(this.storage.getEnergyStored() != this.lastEnergy || this.tank.getFluidAmount() != this.lastTank || this.lastBurnTime != this.currentBurnTime){
|
||||
if((this.storage.getEnergyStored() != this.lastEnergy || this.tank.getFluidAmount() != this.lastTank || this.lastBurnTime != this.currentBurnTime) && this.trySendUpdate()){
|
||||
this.lastEnergy = this.storage.getEnergyStored();
|
||||
this.lastTank = this.tank.getFluidAmount();
|
||||
this.lastBurnTime = this.currentBurnTime;
|
||||
this.sendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,9 +57,8 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement
|
|||
}
|
||||
}
|
||||
|
||||
if(this.isWhitelist != this.lastWhitelist){
|
||||
if(this.isWhitelist != this.lastWhitelist && this.trySendUpdate()){
|
||||
this.lastWhitelist = this.isWhitelist;
|
||||
this.sendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,9 +43,8 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac
|
|||
public void updateEntity(){
|
||||
super.updateEntity();
|
||||
if(!worldObj.isRemote){
|
||||
if(!Objects.equals(this.name, this.nameBefore)){
|
||||
if(!Objects.equals(this.name, this.nameBefore) && this.trySendUpdate()){
|
||||
this.nameBefore = this.name;
|
||||
this.sendUpdate();
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,9 +47,8 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
|||
}
|
||||
}
|
||||
|
||||
if(this.lastAmount != this.amount){
|
||||
if(this.lastAmount != this.amount && this.trySendUpdate()){
|
||||
this.lastAmount = this.amount;
|
||||
this.sendUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue