Changes to Rift Immunity
Changed rifts to consider block blast resistance instead of block hardness. Some mods offer defensive blocks that stop explosions but have low hardness. This addresses that issue. The minimum resistance allows obsidian to resist rifts.
This commit is contained in:
parent
a920a7d65b
commit
6a5fff3b5a
1 changed files with 10 additions and 5 deletions
|
@ -36,7 +36,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
|
||||
public class BlockRift extends Block implements ITileEntityProvider
|
||||
{
|
||||
private static final float MIN_IMMUNE_HARDNESS = 200.0F;
|
||||
private static final float MIN_IMMUNE_RESISTANCE = 5000.0F;
|
||||
private static final int BLOCK_DESTRUCTION_RANGE = 4;
|
||||
private static final int BLOCK_DESTRUCTION_VOLUME = (int) Math.pow(2 * BLOCK_DESTRUCTION_RANGE + 1, 3);
|
||||
private static final int MAX_BLOCK_SEARCH_CHANCE = 100;
|
||||
|
@ -65,11 +65,11 @@ public class BlockRift extends Block implements ITileEntityProvider
|
|||
this.blocksImmuneToRift.add(properties.GoldenDimensionalDoorID);
|
||||
this.blocksImmuneToRift.add(properties.GoldenDoorID);
|
||||
|
||||
this.blocksImmuneToRift.add(Block.blockLapis.blockID);
|
||||
this.blocksImmuneToRift.add(Block.blockIron.blockID);
|
||||
this.blocksImmuneToRift.add(Block.blockGold.blockID);
|
||||
this.blocksImmuneToRift.add(Block.blockDiamond.blockID);
|
||||
this.blocksImmuneToRift.add(Block.blockEmerald.blockID);
|
||||
this.blocksImmuneToRift.add(Block.blockGold.blockID);
|
||||
this.blocksImmuneToRift.add(Block.blockLapis.blockID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -362,8 +362,13 @@ public class BlockRift extends Block implements ITileEntityProvider
|
|||
Block block = Block.blocksList[world.getBlockId(x, y, z)];
|
||||
if (block != null)
|
||||
{
|
||||
float hardness = block.getBlockHardness(world, x, y, z);
|
||||
return (hardness < 0 || hardness >= MIN_IMMUNE_HARDNESS || blocksImmuneToRift.contains(block.blockID));
|
||||
// SenseiKiwi: I've switched to using the block's blast resistance instead of its
|
||||
// hardness since most defensive blocks are meant to defend against explosions and
|
||||
// may have low hardness to make them easier to build with. However, block.getExplosionResistance()
|
||||
// is designed to receive an entity, the source of the blast. We have no entity so
|
||||
// I've set this to access blockResistance directly. Might need changing later.
|
||||
|
||||
return (block.blockResistance >= MIN_IMMUNE_RESISTANCE || blocksImmuneToRift.contains(block.blockID));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue