Fixed Explosion Resistance Bug

Fixed Ancient Fabric and Eternal Fabric being vulnerable to explosions.
I also noticed that a lot of DD blocks have unusual stats. I'm not sure
whether those stats were assigned intentionally or simply because of
copying and pasting code, but the values are certainly counterintuitive
when you consider some of the block materials.
This commit is contained in:
SenseiKiwi 2013-07-19 07:24:11 -04:00
parent 71b9ce263a
commit 0b8a81ef6d
2 changed files with 20 additions and 4 deletions

View file

@ -13,6 +13,7 @@ import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
@ -23,6 +24,7 @@ import net.minecraft.world.World;
public class BlockDimWall extends Block
{
private static final float SUPER_HIGH_HARDNESS = 10000000000000F;
private static final float SUPER_EXPLOSION_RESISTANCE = 18000000F;
private Icon[] blockIcon = new Icon[2];
public BlockDimWall(int blockID, int j, Material par2Material)
@ -31,9 +33,10 @@ public class BlockDimWall extends Block
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
}
public float getBlockHardness(World par1World, int par2, int par3, int par4)
@Override
public float getBlockHardness(World world, int x, int y, int z)
{
if (par1World.getBlockMetadata(par2, par3, par4) == 0)
if (world.getBlockMetadata(x, y, z) == 0)
{
return this.blockHardness;
}
@ -41,7 +44,20 @@ public class BlockDimWall extends Block
{
return SUPER_HIGH_HARDNESS;
}
}
}
@Override
public float getExplosionResistance(Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
{
if (world.getBlockMetadata(x, y, z) == 0)
{
return super.getExplosionResistance(entity, world, x, y, z, explosionX, explosionY, explosionZ);
}
else
{
return SUPER_EXPLOSION_RESISTANCE;
}
}
public void registerIcons(IconRegister par1IconRegister)
{

View file

@ -179,7 +179,7 @@ public class mod_pocketDim
transientDoor = (new TransientDoor(properties.TransientDoorID, Material.iron)).setHardness(1.0F) .setUnlocalizedName("transientDoor");
blockDimWall = (new BlockDimWall(properties.FabricBlockID, 0, Material.iron)).setLightValue(1.0F).setHardness(0.1F).setUnlocalizedName("blockDimWall");
blockDimWallPerm = (new BlockDimWallPerm(properties.PermaFabricBlockID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setUnlocalizedName("blockDimWallPerm");
blockDimWallPerm = (new BlockDimWallPerm(properties.PermaFabricBlockID, 0, Material.iron)).setLightValue(1.0F).setBlockUnbreakable().setResistance(6000000.0F).setUnlocalizedName("blockDimWallPerm");
ExitDoor = (new ExitDoor(properties.WarpDoorID, Material.wood)).setHardness(1.0F) .setUnlocalizedName("dimDoorWarp");
blockRift = (new BlockRift(properties.RiftBlockID, 0, Material.air).setHardness(1.0F) .setUnlocalizedName("rift"));
blockLimbo = (new BlockLimbo(properties.LimboBlockID, 15, Material.iron).setHardness(.2F).setUnlocalizedName("BlockLimbo").setLightValue(.0F));