Added some code to atempt to fix chunkloading conundrums with the Mana Spreader. Possibly related to #711 and #743

This commit is contained in:
Lizbeth Rika committed 2015-04-12 15:39:42 +01:00
1 parent b455d4bc83
commit 34e24837c3
2 files changed
+13 -3

No files matched your search

@@ -120,6 +120,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
public int burstParticleTick = 0;
List<PositionProperties> 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) {
@@ -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;