Do a bunch of checks for isInvalid().

This commit is contained in:
Lizbeth Rika committed 2015-06-08 23:07:10 +01:00
1 parent 6211bb967f
commit 54cfa17511
6 files changed
+11 -9

No files matched your search

@@ -1,4 +1,4 @@
@API(owner = "Botania", apiVersion = "50", provides = "BotaniaAPI")
@API(owner = "Botania", apiVersion = "51", provides = "BotaniaAPI")
package vazkii.botania.api;
import cpw.mods.fml.common.API;
@@ -96,7 +96,7 @@ public class SubTileFunctional extends SubTileEntity {
if(supertile.getWorldObj().blockExists(cachedPoolCoordinates.posX, cachedPoolCoordinates.posY, cachedPoolCoordinates.posZ)) {
needsNew = true;
TileEntity tileAt = supertile.getWorldObj().getTileEntity(cachedPoolCoordinates.posX, cachedPoolCoordinates.posY, cachedPoolCoordinates.posZ);
if(tileAt != null && tileAt instanceof IManaPool) {
if(tileAt != null && tileAt instanceof IManaPool && !tileAt.isInvalid()) {
linkedPool = tileAt;
needsNew = false;
}
@@ -107,7 +107,7 @@ public class SubTileFunctional extends SubTileEntity {
if(!needsNew && linkedPool != null) {
TileEntity tileAt = supertile.getWorldObj().getTileEntity(linkedPool.xCoord, linkedPool.yCoord, linkedPool.zCoord);
if(!(tileAt instanceof IManaPool)) {
if(!(tileAt instanceof IManaPool) || !tileAt.isInvalid()) {
linkedPool = null;
needsNew = true;
} else linkedPool = tileAt;
@@ -89,7 +89,7 @@ public class SubTileGenerating extends SubTileEntity {
if(supertile.getWorldObj().blockExists(cachedCollectorCoordinates.posX, cachedCollectorCoordinates.posY, cachedCollectorCoordinates.posZ)) {
needsNew = true;
TileEntity tileAt = supertile.getWorldObj().getTileEntity(cachedCollectorCoordinates.posX, cachedCollectorCoordinates.posY, cachedCollectorCoordinates.posZ);
if(tileAt != null && tileAt instanceof IManaCollector) {
if(tileAt != null && tileAt instanceof IManaCollector && !tileAt.isInvalid()) {
linkedCollector = tileAt;
needsNew = false;
}
@@ -100,7 +100,7 @@ public class SubTileGenerating extends SubTileEntity {
if(!needsNew && linkedCollector != null) {
TileEntity tileAt = supertile.getWorldObj().getTileEntity(linkedCollector.xCoord, linkedCollector.yCoord, linkedCollector.zCoord);
if(!(tileAt instanceof IManaCollector)) {
if(!(tileAt instanceof IManaCollector) || !tileAt.isInvalid()) {
linkedCollector = null;
needsNew = true;
} else linkedCollector = tileAt;
@@ -112,7 +112,7 @@ public class TilePool extends TileMod implements IManaPool, IDyablePool, IKeyLoc
@Override
public void onChunkUnload() {
super.onChunkUnload();
ManaNetworkEvent.removePool(this);
invalidate();
}
public boolean collideEntityItem(EntityItem item) {
@@ -180,7 +180,7 @@ public class TilePool extends TileMod implements IManaPool, IDyablePool, IKeyLoc
if(manaCap == -1)
manaCap = getBlockMetadata() == 2 ? MAX_MANA_DILLUTED : MAX_MANA;
if(!ManaNetworkHandler.instance.isPoolIn(this))
if(!ManaNetworkHandler.instance.isPoolIn(this) && !isInvalid())
ManaNetworkEvent.addPool(this);
if(soundTicks > 0)
@@ -143,12 +143,12 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
@Override
public void onChunkUnload() {
super.onChunkUnload();
ManaNetworkEvent.removeCollector(this);
invalidate();
}
@Override
public void updateEntity() {
if(!ManaNetworkHandler.instance.isCollectorIn(this))
if(!ManaNetworkHandler.instance.isCollectorIn(this) && !isInvalid())
ManaNetworkEvent.addCollector(this);
boolean redstone = false;
@@ -90,6 +90,8 @@ public final class ManaNetworkHandler implements IManaNetwork {
continue;
TileEntity tile = sig.tile;
if(tile.isInvalid())
continue;
float distance = MathHelper.pointDistanceSpace(tile.xCoord, tile.yCoord, tile.zCoord, pos.posX, pos.posY, pos.posZ);
if(distance > limit)
continue;