mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge pull request #1353 from MellowArpeggiation/master
Fix spotlight beams crashing in nuclear explosions
This commit is contained in:
commit
8f840f5145
@ -41,7 +41,12 @@ public class BlockFallout extends Block {
|
|||||||
|
|
||||||
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
|
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
|
||||||
Block block = world.getBlock(x, y - 1, 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
|
@Override
|
||||||
|
|||||||
@ -250,8 +250,9 @@ public class Spotlight extends Block implements ISpotlight {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we encounter an existing beam, add a new INCOMING direction to the
|
// If we encounter an existing beam, add a new INCOMING direction to the
|
||||||
// metadata
|
// metadata, and cancel propagation if something goes wrong
|
||||||
SpotlightBeam.setDirection(world, x, y, z, dir, true);
|
if (SpotlightBeam.setDirection(world, x, y, z, dir, true) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
propagateBeam(world, x, y, z, dir, distance);
|
propagateBeam(world, x, y, z, dir, distance);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,6 +69,7 @@ public class SpotlightBeam extends BlockContainer {
|
|||||||
// Returns the final metadata, so the caller can optionally remove the block
|
// 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) {
|
public static int setDirection(World world, int x, int y, int z, ForgeDirection dir, boolean state) {
|
||||||
TileEntityData te = (TileEntityData) world.getTileEntity(x, y, z);
|
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);
|
int transformedMetadata = applyDirection(te.metadata, dir, state);
|
||||||
te.metadata = transformedMetadata;
|
te.metadata = transformedMetadata;
|
||||||
return transformedMetadata;
|
return transformedMetadata;
|
||||||
|
|||||||
@ -211,12 +211,12 @@ public class EntityFalloutRain extends Entity {
|
|||||||
float hardness = b.getBlockHardness(worldObj, x, y, z);
|
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))*/) {
|
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(worldObj.getBlock(x, y - 1, z) == Blocks.air) {
|
||||||
if(bl == Blocks.air) {
|
|
||||||
for(int i = 0; i <= depth; i++) {
|
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) {
|
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
|
entityfallingblock.canDrop = false; //turn off block drops because block dropping was coded by a mule with dementia
|
||||||
worldObj.spawnEntityInWorld(entityfallingblock);
|
worldObj.spawnEntityInWorld(entityfallingblock);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import com.hbm.blocks.BlockFallingNT;
|
import com.hbm.blocks.BlockFallingNT;
|
||||||
|
import com.hbm.blocks.ISpotlight;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -91,7 +92,7 @@ public class EntityFallingBlockNT extends Entity {
|
|||||||
|
|
||||||
public void onUpdate() {
|
public void onUpdate() {
|
||||||
|
|
||||||
if(this.getBlock().getMaterial() == Material.air) {
|
if(this.getBlock().getMaterial() == Material.air || this.getBlock() instanceof ISpotlight) {
|
||||||
this.setDead();
|
this.setDead();
|
||||||
} else {
|
} else {
|
||||||
this.prevPosX = this.posX;
|
this.prevPosX = this.posX;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user