From 34e24837c31a0f17a4821f022350dbdf8a6c6a90 Mon Sep 17 00:00:00 2001 From: Lizbeth Rika Date: Sun, 12 Apr 2015 15:39:42 +0100 Subject: [PATCH] Added some code to atempt to fix chunkloading conundrums with the Mana Spreader. Possibly related to #711 and #743 --- .../botania/common/block/tile/mana/TileSpreader.java | 9 ++++++--- .../vazkii/botania/common/entity/EntityManaBurst.java | 7 +++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/vazkii/botania/common/block/tile/mana/TileSpreader.java b/src/main/java/vazkii/botania/common/block/tile/mana/TileSpreader.java index 3d9b06e22..a2707ad1a 100644 --- a/src/main/java/vazkii/botania/common/block/tile/mana/TileSpreader.java +++ b/src/main/java/vazkii/botania/common/block/tile/mana/TileSpreader.java @@ -120,6 +120,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector, public int burstParticleTick = 0; List lastTentativeBurst; + boolean invalidTentativeBurst = false; @Override public boolean isFull() { @@ -323,14 +324,16 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector, return true; for(PositionProperties props : lastTentativeBurst) - if(!props.contentsEqual(worldObj)) - return true; + if(!props.contentsEqual(worldObj)) { + invalidTentativeBurst = props.invalid; + return !invalidTentativeBurst; + } return false; } public void tryShootBurst() { - if(receiver != null || isRedstone()) { + if((receiver != null || isRedstone()) && !invalidTentativeBurst) { if(canShootBurst && (isRedstone() || receiver.canRecieveManaFromBursts() && !receiver.isFull())) { EntityManaBurst burst = getBurst(false); if(burst != null) { diff --git a/src/main/java/vazkii/botania/common/entity/EntityManaBurst.java b/src/main/java/vazkii/botania/common/entity/EntityManaBurst.java index f16df207d..7ea176073 100644 --- a/src/main/java/vazkii/botania/common/entity/EntityManaBurst.java +++ b/src/main/java/vazkii/botania/common/entity/EntityManaBurst.java @@ -804,6 +804,8 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst { public final ChunkCoordinates coords; public final Block block; public final int meta; + + public boolean invalid = false; public PositionProperties(Entity entity) { int x = MathHelper.floor_double(entity.posX); @@ -819,6 +821,11 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst { } public boolean contentsEqual(World world) { + if(!world.blockExists(coords.posX, coords.posY, coords.posZ)) { + invalid = true; + return false; + } + Block block = world.getBlock(coords.posX , coords.posY, coords.posZ); int meta = world.getBlockMetadata(coords.posX, coords.posY, coords.posZ); return block == this.block && meta == this.meta;