From 53a78fc950866a67ab00772650321f4a805519a3 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Thu, 21 Aug 2014 22:45:56 -0500 Subject: [PATCH] Prevent a number of AE2 blocks from reloading a chunk while its unloading. --- tile/AEBaseTile.java | 5 +++++ tile/crafting/TileCraftingStorageTile.java | 2 +- tile/crafting/TileCraftingTile.java | 3 +++ tile/networking/TileEnergyCell.java | 3 +++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tile/AEBaseTile.java b/tile/AEBaseTile.java index 969da396..01dba94b 100644 --- a/tile/AEBaseTile.java +++ b/tile/AEBaseTile.java @@ -48,6 +48,11 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, public int renderFragment = 0; public String customName; + public boolean notLoaded() + { + return !worldObj.blockExists( xCoord, yCoord, zCoord ); + } + public TileEntity getTile() { return this; diff --git a/tile/crafting/TileCraftingStorageTile.java b/tile/crafting/TileCraftingStorageTile.java index 520c2752..f4ef9c0f 100644 --- a/tile/crafting/TileCraftingStorageTile.java +++ b/tile/crafting/TileCraftingStorageTile.java @@ -37,7 +37,7 @@ public class TileCraftingStorageTile extends TileCraftingTile public int getStorageBytes() { - if ( worldObj == null ) + if ( worldObj == null || notLoaded() ) return 0; switch (worldObj.getBlockMetadata( xCoord, yCoord, zCoord ) & 3) diff --git a/tile/crafting/TileCraftingTile.java b/tile/crafting/TileCraftingTile.java index 4150feb6..65b62891 100644 --- a/tile/crafting/TileCraftingTile.java +++ b/tile/crafting/TileCraftingTile.java @@ -154,6 +154,9 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP public void updateMeta(boolean updateFormed) { + if ( worldObj == null || notLoaded() ) + return; + boolean formed = isFormed(); boolean power = false; diff --git a/tile/networking/TileEnergyCell.java b/tile/networking/TileEnergyCell.java index a3ef4063..4aa143dd 100644 --- a/tile/networking/TileEnergyCell.java +++ b/tile/networking/TileEnergyCell.java @@ -31,6 +31,9 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage private void changePowerLevel() { + if ( notLoaded() ) + return; + byte leel = (byte) (8.0 * (internalCurrentPower / internalMaxPower)); if ( leel > 7 )