From f62b1ede79c5d23a025e1814c32c83641f72dab0 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 1 Dec 2015 17:28:50 +0100 Subject: [PATCH] Changed Tile Updating methodo to reduce performance usage and lag --- .../blocks/BlockBookletStand.java | 2 +- .../items/ItemLaserWrench.java | 4 +- .../network/PacketBookletStandButton.java | 2 +- .../network/VanillaPacketSyncer.java | 38 +++++++++++++++++++ .../tile/TileEntityAtomicReconstructor.java | 4 +- .../tile/TileEntityBase.java | 9 ++++- .../tile/TileEntityCanolaPress.java | 2 +- .../tile/TileEntityCoalGenerator.java | 2 +- .../tile/TileEntityCoffeeMachine.java | 2 +- .../tile/TileEntityDirectionalBreaker.java | 2 +- .../tile/TileEntityEnergizer.java | 2 +- .../tile/TileEntityEnervator.java | 2 +- .../tile/TileEntityFeeder.java | 2 +- .../tile/TileEntityFermentingBarrel.java | 2 +- .../tile/TileEntityFluidCollector.java | 2 +- .../tile/TileEntityFurnaceDouble.java | 2 +- .../tile/TileEntityGrinder.java | 2 +- .../tile/TileEntityInputter.java | 2 +- .../tile/TileEntityItemRepairer.java | 2 +- .../tile/TileEntityOilGenerator.java | 2 +- .../tile/TileEntityPhantomface.java | 10 ++++- .../tile/TileEntityRangedCollector.java | 2 +- .../tile/TileEntitySmileyCloud.java | 2 +- .../tile/TileEntityXPSolidifier.java | 2 +- .../actuallyadditions/util/WorldPos.java | 6 --- .../actuallyadditions/util/WorldUtil.java | 11 ------ 26 files changed, 76 insertions(+), 44 deletions(-) create mode 100644 src/main/java/ellpeck/actuallyadditions/network/VanillaPacketSyncer.java diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockBookletStand.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockBookletStand.java index 94d857e9d..d0e916d2b 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockBookletStand.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockBookletStand.java @@ -92,7 +92,7 @@ public class BlockBookletStand extends BlockContainerBase implements IActAddItem if(tile.assignedPlayer == null){ tile.assignedPlayer = player.getCommandSenderName(); tile.markDirty(); - world.markBlockForUpdate(x, y, z); + tile.sendUpdate(); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemLaserWrench.java b/src/main/java/ellpeck/actuallyadditions/items/ItemLaserWrench.java index 38f686df0..3e05dfc03 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemLaserWrench.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemLaserWrench.java @@ -53,8 +53,8 @@ public class ItemLaserWrench extends Item implements IActAddItemOrBlock{ if(savedPos.getTileEntity() instanceof TileEntityLaserRelay && LaserRelayConnectionHandler.getInstance().addConnection(savedPos, otherPos)){ ItemPhantomConnector.clearStorage(stack); - savedPos.update(); - otherPos.update(); + ((TileEntityLaserRelay)savedPos.getTileEntity()).sendUpdate(); + ((TileEntityLaserRelay)otherPos.getTileEntity()).sendUpdate(); player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".laser.connected.desc"))); } diff --git a/src/main/java/ellpeck/actuallyadditions/network/PacketBookletStandButton.java b/src/main/java/ellpeck/actuallyadditions/network/PacketBookletStandButton.java index e068fcaaa..92cd3d7d0 100644 --- a/src/main/java/ellpeck/actuallyadditions/network/PacketBookletStandButton.java +++ b/src/main/java/ellpeck/actuallyadditions/network/PacketBookletStandButton.java @@ -96,7 +96,7 @@ public class PacketBookletStandButton implements IMessage{ if(tile instanceof TileEntityBookletStand){ if(Objects.equals(player.getCommandSenderName(), ((TileEntityBookletStand)tile).assignedPlayer)){ ((TileEntityBookletStand)tile).setEntry(message.entryID, message.chapterID, message.pageID, message.pageInIndex); - world.markBlockForUpdate(message.tileX, message.tileY, message.tileZ); + ((TileEntityBookletStand)tile).sendUpdate(); } } diff --git a/src/main/java/ellpeck/actuallyadditions/network/VanillaPacketSyncer.java b/src/main/java/ellpeck/actuallyadditions/network/VanillaPacketSyncer.java new file mode 100644 index 000000000..6186487b8 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/network/VanillaPacketSyncer.java @@ -0,0 +1,38 @@ +/* + * This file ("VanillaPacketSyncer.java") is part of the Actually Additions Mod for Minecraft. + * It is created and owned by Ellpeck and distributed + * under the Actually Additions License to be found at + * http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md + * View the source code at https://github.com/Ellpeck/ActuallyAdditions + * + * © 2015 Ellpeck + */ + +package ellpeck.actuallyadditions.network; + +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.tileentity.TileEntity; + +import java.util.List; + +public class VanillaPacketSyncer{ + + public static void sendTileToNearbyPlayers(TileEntity tile){ + List allPlayers = tile.getWorldObj().playerEntities; + for(Object player : allPlayers){ + if(player instanceof EntityPlayerMP){ + sendTileToPlayer(tile, (EntityPlayerMP)player, 64); + } + } + } + + public static void sendTileToPlayer(TileEntity tile, EntityPlayerMP player, int maxDistance){ + if(player.getDistance(tile.xCoord, tile.yCoord, tile.zCoord) <= maxDistance){ + sendTileToPlayer(tile, player); + } + } + + public static void sendTileToPlayer(TileEntity tile, EntityPlayerMP player){ + player.playerNetServerHandler.sendPacket(tile.getDescriptionPacket()); + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityAtomicReconstructor.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityAtomicReconstructor.java index ddcfe6f61..b25064ff2 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityAtomicReconstructor.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityAtomicReconstructor.java @@ -229,13 +229,13 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple @Override public ItemStack decrStackSize(int i, int j){ - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + this.sendUpdate(); return super.decrStackSize(i, j); } @Override public void setInventorySlotContents(int i, ItemStack stack){ super.setInventorySlotContents(i, stack); - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + this.sendUpdate(); } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java index b53a80db4..d66202cc8 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java @@ -12,6 +12,7 @@ package ellpeck.actuallyadditions.tile; import cpw.mods.fml.common.registry.GameRegistry; import ellpeck.actuallyadditions.config.values.ConfigIntValues; +import ellpeck.actuallyadditions.network.VanillaPacketSyncer; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; @@ -112,13 +113,17 @@ public abstract class TileEntityBase extends TileEntity{ } - protected boolean trySendUpdate(){ + protected boolean sendUpdateWithInterval(){ if(this.ticksElapsed % ConfigIntValues.TILE_ENTITY_UPDATE_INTERVAL.getValue() == 0){ - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); + this.sendUpdate(); return true; } else{ return false; } } + + public void sendUpdate(){ + VanillaPacketSyncer.sendTileToNearbyPlayers(this); + } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCanolaPress.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCanolaPress.java index dd8406e4a..95898013a 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCanolaPress.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCanolaPress.java @@ -79,7 +79,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE } } - if((this.storage.getEnergyStored() != this.lastEnergyStored || this.tank.getFluidAmount() != this.lastTankAmount | this.currentProcessTime != this.lastProcessTime) && this.trySendUpdate()){ + if((this.storage.getEnergyStored() != this.lastEnergyStored || this.tank.getFluidAmount() != this.lastTankAmount | this.currentProcessTime != this.lastProcessTime) && this.sendUpdateWithInterval()){ this.lastEnergyStored = this.storage.getEnergyStored(); this.lastProcessTime = this.currentProcessTime; this.lastTankAmount = this.tank.getFluidAmount(); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java index 77a9400eb..5aaa7df50 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java @@ -81,7 +81,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements } } - if((this.storage.getEnergyStored() != this.lastEnergy || this.currentBurnTime != this.lastCurrentBurnTime || this.lastBurnTime != this.maxBurnTime) && this.trySendUpdate()){ + if((this.storage.getEnergyStored() != this.lastEnergy || this.currentBurnTime != this.lastCurrentBurnTime || this.lastBurnTime != this.maxBurnTime) && this.sendUpdateWithInterval()){ this.lastEnergy = this.storage.getEnergyStored(); this.lastCurrentBurnTime = this.currentBurnTime; this.lastBurnTime = this.currentBurnTime; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java index dc9a6db3e..62a112dc9 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java @@ -61,7 +61,7 @@ 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) && this.trySendUpdate()){ + if((this.coffeeCacheAmount != this.lastCoffeeAmount || this.storage.getEnergyStored() != this.lastEnergy || this.tank.getFluidAmount() != this.lastTank || this.brewTime != this.lastBrewTime) && this.sendUpdateWithInterval()){ this.lastCoffeeAmount = coffeeCacheAmount; this.lastEnergy = this.storage.getEnergyStored(); this.lastTank = this.tank.getFluidAmount(); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDirectionalBreaker.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDirectionalBreaker.java index ee8956e72..f389320e3 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDirectionalBreaker.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDirectionalBreaker.java @@ -77,7 +77,7 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem } } - if(this.storage.getEnergyStored() != this.lastEnergy && this.trySendUpdate()){ + if(this.storage.getEnergyStored() != this.lastEnergy && this.sendUpdateWithInterval()){ this.lastEnergy = this.storage.getEnergyStored(); } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java index a2b5fb7d4..68e652113 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java @@ -47,7 +47,7 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne } } - if(lastEnergy != this.storage.getEnergyStored() && this.trySendUpdate()){ + if(lastEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()){ this.lastEnergy = this.storage.getEnergyStored(); } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java index b547cc178..b0fcf27b7 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java @@ -57,7 +57,7 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, storage); } - if(lastEnergy != this.storage.getEnergyStored() && this.trySendUpdate()){ + if(lastEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()){ this.lastEnergy = this.storage.getEnergyStored(); } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFeeder.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFeeder.java index 7b54c2ee1..f964b2d3e 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFeeder.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFeeder.java @@ -78,7 +78,7 @@ public class TileEntityFeeder extends TileEntityInventoryBase{ this.markDirty(); } - if((this.lastAnimalAmount != this.currentAnimalAmount || this.lastTimer != this.currentTimer) && this.trySendUpdate()){ + if((this.lastAnimalAmount != this.currentAnimalAmount || this.lastTimer != this.currentTimer) && this.sendUpdateWithInterval()){ this.lastAnimalAmount = this.currentAnimalAmount; this.lastTimer = this.currentTimer; } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFermentingBarrel.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFermentingBarrel.java index 1d9d7611b..04ebb38f5 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFermentingBarrel.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFermentingBarrel.java @@ -68,7 +68,7 @@ public class TileEntityFermentingBarrel extends TileEntityInventoryBase implemen } } - if((this.canolaTank.getFluidAmount() != this.lastCanola || this.oilTank.getFluidAmount() != this.lastOil || this.currentProcessTime != this.lastProcessTime) && this.trySendUpdate()){ + if((this.canolaTank.getFluidAmount() != this.lastCanola || this.oilTank.getFluidAmount() != this.lastOil || this.currentProcessTime != this.lastProcessTime) && this.sendUpdateWithInterval()){ this.lastProcessTime = this.currentProcessTime; this.lastCanola = this.canolaTank.getFluidAmount(); this.lastOil = this.oilTank.getFluidAmount(); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFluidCollector.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFluidCollector.java index 642328a8b..6416e9454 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFluidCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFluidCollector.java @@ -146,7 +146,7 @@ public class TileEntityFluidCollector extends TileEntityInventoryBase implements } } - if(lastTankAmount != this.tank.getFluidAmount() && this.trySendUpdate()){ + if(lastTankAmount != this.tank.getFluidAmount() && this.sendUpdateWithInterval()){ lastTankAmount = this.tank.getFluidAmount(); } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java index 810409e45..e5346d5da 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java @@ -94,7 +94,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements } } - if((lastEnergy != this.storage.getEnergyStored() || this.lastFirstSmelt != this.firstSmeltTime || this.lastSecondSmelt != this.secondSmeltTime) && this.trySendUpdate()){ + if((lastEnergy != this.storage.getEnergyStored() || this.lastFirstSmelt != this.firstSmeltTime || this.lastSecondSmelt != this.secondSmeltTime) && this.sendUpdateWithInterval()){ this.lastEnergy = this.storage.getEnergyStored(); this.lastFirstSmelt = this.firstSmeltTime; this.lastSecondSmelt = this.secondSmeltTime; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java index c17f8efe6..8d40e6bcc 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java @@ -126,7 +126,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg } } - if((lastEnergy != this.storage.getEnergyStored() || this.lastFirstCrush != this.firstCrushTime || this.lastSecondCrush != this.secondCrushTime) && this.trySendUpdate()){ + if((lastEnergy != this.storage.getEnergyStored() || this.lastFirstCrush != this.firstCrushTime || this.lastSecondCrush != this.secondCrushTime) && this.sendUpdateWithInterval()){ this.lastEnergy = this.storage.getEnergyStored(); this.lastFirstCrush = this.firstCrushTime; this.lastSecondCrush = this.secondCrushTime; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java index 565ad4379..954547be4 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java @@ -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) && this.trySendUpdate()){ + 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.sendUpdateWithInterval()){ this.lastPutSide = this.sideToPut; this.lastPullSide = this.sideToPull; this.lastPullStart = this.slotToPullStart; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java index 12a9da2d3..2b59dbf63 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java @@ -59,7 +59,7 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I this.nextRepairTick = 0; } - if(this.lastEnergy != this.storage.getEnergyStored() && this.trySendUpdate()){ + if(this.lastEnergy != this.storage.getEnergyStored() && this.sendUpdateWithInterval()){ this.lastEnergy = this.storage.getEnergyStored(); } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java index f5c6e60b5..c2dc74245 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java @@ -81,7 +81,7 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I } } - if((this.storage.getEnergyStored() != this.lastEnergy || this.tank.getFluidAmount() != this.lastTank || this.lastBurnTime != this.currentBurnTime) && this.trySendUpdate()){ + if((this.storage.getEnergyStored() != this.lastEnergy || this.tank.getFluidAmount() != this.lastTank || this.lastBurnTime != this.currentBurnTime) && this.sendUpdateWithInterval()){ this.lastEnergy = this.storage.getEnergyStored(); this.lastTank = this.tank.getFluidAmount(); this.lastBurnTime = this.currentBurnTime; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java index 2bb8a31a3..0000b0449 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java @@ -16,7 +16,6 @@ import ellpeck.actuallyadditions.blocks.BlockPhantom; import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.util.Util; import ellpeck.actuallyadditions.util.WorldPos; -import ellpeck.actuallyadditions.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -55,7 +54,14 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP this.rangeBefore = this.range; this.boundPosBefore = this.boundPosition; this.boundBlockBefore = this.boundPosition == null ? null : this.boundPosition.getBlock(); - WorldUtil.updateTileAndTilesAround(this); + + this.getWorldObj().markBlockForUpdate(this.xCoord+1, this.yCoord, this.zCoord); + this.getWorldObj().markBlockForUpdate(this.xCoord-1, this.yCoord, this.zCoord); + this.getWorldObj().markBlockForUpdate(this.xCoord, this.yCoord+1, this.zCoord); + this.getWorldObj().markBlockForUpdate(this.xCoord, this.yCoord-1, this.zCoord); + this.getWorldObj().markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord+1); + this.getWorldObj().markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord-1); + this.markDirty(); } } else{ diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityRangedCollector.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityRangedCollector.java index aab8801a7..3e658f2aa 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityRangedCollector.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityRangedCollector.java @@ -57,7 +57,7 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement } } - if(this.isWhitelist != this.lastWhitelist && this.trySendUpdate()){ + if(this.isWhitelist != this.lastWhitelist && this.sendUpdateWithInterval()){ this.lastWhitelist = this.isWhitelist; } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntitySmileyCloud.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntitySmileyCloud.java index c3395aea6..64ed76996 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntitySmileyCloud.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntitySmileyCloud.java @@ -43,7 +43,7 @@ public class TileEntitySmileyCloud extends TileEntityBase implements IStringReac public void updateEntity(){ super.updateEntity(); if(!worldObj.isRemote){ - if(!Objects.equals(this.name, this.nameBefore) && this.trySendUpdate()){ + if(!Objects.equals(this.name, this.nameBefore) && this.sendUpdateWithInterval()){ this.nameBefore = this.name; this.markDirty(); } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java index 4a03cfdc0..52cee1833 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java @@ -47,7 +47,7 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } } - if(this.lastAmount != this.amount && this.trySendUpdate()){ + if(this.lastAmount != this.amount && this.sendUpdateWithInterval()){ this.lastAmount = this.amount; } } diff --git a/src/main/java/ellpeck/actuallyadditions/util/WorldPos.java b/src/main/java/ellpeck/actuallyadditions/util/WorldPos.java index 8f4a69ea5..5d556d52e 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/WorldPos.java +++ b/src/main/java/ellpeck/actuallyadditions/util/WorldPos.java @@ -86,12 +86,6 @@ public class WorldPos{ return this.z; } - public void update(){ - if(this.getWorld() != null){ - this.getWorld().markBlockForUpdate(this.x, this.y, this.z); - } - } - public WorldPos copy(){ return new WorldPos(this.getWorld(), this.x, this.y, this.z); } diff --git a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java index b8a151fc1..7bdecde0c 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/WorldUtil.java @@ -111,17 +111,6 @@ public class WorldUtil{ return true; } - public static void updateTileAndTilesAround(TileEntity tile){ - tile.getWorldObj().markBlockForUpdate(tile.xCoord+1, tile.yCoord, tile.zCoord); - tile.getWorldObj().markBlockForUpdate(tile.xCoord-1, tile.yCoord, tile.zCoord); - tile.getWorldObj().markBlockForUpdate(tile.xCoord, tile.yCoord+1, tile.zCoord); - tile.getWorldObj().markBlockForUpdate(tile.xCoord, tile.yCoord-1, tile.zCoord); - tile.getWorldObj().markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord+1); - tile.getWorldObj().markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord-1); - tile.getWorldObj().markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord); - tile.markDirty(); - } - public static void pushFluid(World world, int x, int y, int z, ForgeDirection side, FluidTank tank){ TileEntity tile = getTileEntityFromSide(side, world, x, y, z); if(tile != null && tank.getFluid() != null && tile instanceof IFluidHandler){