diff --git a/src/main/java/com/hbm/blocks/generic/BlockFallout.java b/src/main/java/com/hbm/blocks/generic/BlockFallout.java index 9e273006a..175b1dd40 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockFallout.java +++ b/src/main/java/com/hbm/blocks/generic/BlockFallout.java @@ -41,7 +41,12 @@ public class BlockFallout extends Block { public boolean canPlaceBlockAt(World world, int x, int y, int z) { Block block = world.getBlock(x, y - 1, z); - return block != Blocks.ice && block != Blocks.packed_ice ? (block.isLeaves(world, x, y - 1, z) ? true : (block == this && (world.getBlockMetadata(x, y - 1, z) & 7) == 7 ? true : block.isOpaqueCube() && block.getMaterial().blocksMovement())) : false; + + if (block == Blocks.ice || block == Blocks.packed_ice) return false; + if (block.isLeaves(world, x, y - 1, z) && !block.isAir(world, x, y - 1, z)) return true; + if (block == this && (world.getBlockMetadata(x, y - 1, z) & 7) == 7) return true; + + return block.isOpaqueCube() && block.getMaterial().blocksMovement(); } @Override diff --git a/src/main/java/com/hbm/blocks/machine/Spotlight.java b/src/main/java/com/hbm/blocks/machine/Spotlight.java index b5f7b0c56..c40a9ef9c 100644 --- a/src/main/java/com/hbm/blocks/machine/Spotlight.java +++ b/src/main/java/com/hbm/blocks/machine/Spotlight.java @@ -250,8 +250,9 @@ public class Spotlight extends Block implements ISpotlight { } // If we encounter an existing beam, add a new INCOMING direction to the - // metadata - SpotlightBeam.setDirection(world, x, y, z, dir, true); + // metadata, and cancel propagation if something goes wrong + if (SpotlightBeam.setDirection(world, x, y, z, dir, true) == 0) + return; propagateBeam(world, x, y, z, dir, distance); } diff --git a/src/main/java/com/hbm/blocks/machine/SpotlightBeam.java b/src/main/java/com/hbm/blocks/machine/SpotlightBeam.java index b96cc4a6a..44c7c7209 100644 --- a/src/main/java/com/hbm/blocks/machine/SpotlightBeam.java +++ b/src/main/java/com/hbm/blocks/machine/SpotlightBeam.java @@ -69,6 +69,7 @@ public class SpotlightBeam extends BlockContainer { // Returns the final metadata, so the caller can optionally remove the block public static int setDirection(World world, int x, int y, int z, ForgeDirection dir, boolean state) { TileEntityData te = (TileEntityData) world.getTileEntity(x, y, z); + if (te == null) return 0; // This shouldn't happen, and if it does, cancel propagation int transformedMetadata = applyDirection(te.metadata, dir, state); te.metadata = transformedMetadata; return transformedMetadata; diff --git a/src/main/java/com/hbm/entity/effect/EntityFalloutRain.java b/src/main/java/com/hbm/entity/effect/EntityFalloutRain.java index abddcb261..df36d3276 100644 --- a/src/main/java/com/hbm/entity/effect/EntityFalloutRain.java +++ b/src/main/java/com/hbm/entity/effect/EntityFalloutRain.java @@ -211,12 +211,12 @@ public class EntityFalloutRain extends Entity { float hardness = b.getBlockHardness(worldObj, x, y, z); if(dist < 65 && hardness <= Blocks.stonebrick.getExplosionResistance(null) && hardness >= 0/* && !b.hasTileEntity(worldObj.getBlockMetadata(x, y, z))*/) { - Block bl = worldObj.getBlock(x, y - 1, z); - if(bl == Blocks.air) { + if(worldObj.getBlock(x, y - 1, z) == Blocks.air) { for(int i = 0; i <= depth; i++) { - hardness = worldObj.getBlock(x, y + i, z).getBlockHardness(worldObj, x, y + i, z); + Block block = worldObj.getBlock(x, y + i, z); + hardness = block.getBlockHardness(worldObj, x, y + i, z); if(hardness <= Blocks.stonebrick.getExplosionResistance(null) && hardness >= 0) { - EntityFallingBlockNT entityfallingblock = new EntityFallingBlockNT(worldObj, x + 0.5D, y + 0.5D + i, z + 0.5D, worldObj.getBlock(x, y + i, z), worldObj.getBlockMetadata(x, y + i, z)); + EntityFallingBlockNT entityfallingblock = new EntityFallingBlockNT(worldObj, x + 0.5D, y + 0.5D + i, z + 0.5D, block, worldObj.getBlockMetadata(x, y + i, z)); entityfallingblock.canDrop = false; //turn off block drops because block dropping was coded by a mule with dementia worldObj.spawnEntityInWorld(entityfallingblock); } diff --git a/src/main/java/com/hbm/entity/item/EntityFallingBlockNT.java b/src/main/java/com/hbm/entity/item/EntityFallingBlockNT.java index cabc90143..150c4352f 100644 --- a/src/main/java/com/hbm/entity/item/EntityFallingBlockNT.java +++ b/src/main/java/com/hbm/entity/item/EntityFallingBlockNT.java @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.Iterator; import com.hbm.blocks.BlockFallingNT; +import com.hbm.blocks.ISpotlight; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -91,7 +92,7 @@ public class EntityFallingBlockNT extends Entity { public void onUpdate() { - if(this.getBlock().getMaterial() == Material.air) { + if(this.getBlock().getMaterial() == Material.air || this.getBlock() instanceof ISpotlight) { this.setDead(); } else { this.prevPosX = this.posX;