Added better checking for SubTileFunctional and SubTileGenerating.

This commit is contained in:
Vasco Lavos committed 2014-06-14 21:39:06 +01:00
1 parent 04154e9c2c
commit 64f2d3b1d7
2 files changed
+8 -2

No files matched your search

@@ -63,7 +63,8 @@ public class SubTileFunctional extends SubTileEntity {
public void onUpdate() {
super.onUpdate();
linkPool();
if(!supertile.getWorldObj().isRemote || cachedPoolCoordinates != null)
linkPool();
if(linkedPool != null) {
IManaPool pool = (IManaPool) linkedPool;
@@ -101,6 +102,7 @@ public class SubTileFunctional extends SubTileEntity {
TileEntity tileAt = supertile.getWorldObj().getTileEntity(cachedPoolCoordinates.posX, cachedPoolCoordinates.posY, cachedPoolCoordinates.posZ);
if(tileAt != null && tileAt instanceof IManaPool) {
linkedPool = tileAt;
sync();
needsNew = false;
}
cachedPoolCoordinates = null;
@@ -121,6 +123,7 @@ public class SubTileFunctional extends SubTileEntity {
if(size != sizeLastCheck) {
ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord, supertile.yCoord, supertile.zCoord);
linkedPool = network.getClosestPool(coords, supertile.getWorldObj(), range);
sync();
sizeLastCheck = size;
}
}
@@ -54,7 +54,8 @@ public class SubTileGenerating extends SubTileEntity {
public void onUpdate() {
super.onUpdate();
linkCollector();
if(!supertile.getWorldObj().isRemote || cachedCollectorCoordinates != null)
linkCollector();
if(canGeneratePassively()) {
int delay = getDelayBetweenPassiveGeneration();
@@ -85,6 +86,7 @@ public class SubTileGenerating extends SubTileEntity {
TileEntity tileAt = supertile.getWorldObj().getTileEntity(cachedCollectorCoordinates.posX, cachedCollectorCoordinates.posY, cachedCollectorCoordinates.posZ);
if(tileAt != null && tileAt instanceof IManaCollector) {
linkedCollector = tileAt;
sync();
needsNew = false;
}
cachedCollectorCoordinates = null;
@@ -106,6 +108,7 @@ public class SubTileGenerating extends SubTileEntity {
ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord, supertile.yCoord, supertile.zCoord);
linkedCollector = network.getClosestCollector(coords, supertile.getWorldObj(), range);
sizeLastCheck = size;
sync();
}
}
}