Merge pull request #44 from SenseiKiwi/master

Fixed Explosion Resistance Bug and Hopper Metadata Rotation
This commit is contained in:
StevenRS11 2013-07-19 09:00:07 -07:00
commit 9290781094
3 changed files with 83 additions and 32 deletions

View file

@ -36,6 +36,8 @@ import StevenDimDoors.mod_pocketDim.ticking.MobObelisk;
public class SchematicLoader
{
private final static int EAST_DOOR_METADATA = 0;
private final static int SOUTH_DOOR_METADATA = 1;
private final static int WEST_DOOR_METADATA = 2;
private final static int NORTH_DOOR_METADATA = 3;
private final static int MAX_VANILLA_BLOCK_ID = 158;
@ -49,8 +51,26 @@ public class SchematicLoader
{
switch (orientation)
{
case 0:
case EAST_DOOR_METADATA:
if (blockID == Block.hopperBlock.blockID)
{
switch (metadata)
{
case 2:
metadata = 5;
break;
case 3:
metadata = 4;
break;
case 4:
metadata = 2;
break;
case 5:
metadata = 3;
break;
}
}
if(Block.blocksList[blockID] instanceof BlockStairs)
{
@ -238,7 +258,27 @@ public class SchematicLoader
}
}
break;
case 1:
case SOUTH_DOOR_METADATA:
if (blockID == Block.hopperBlock.blockID)
{
switch (metadata)
{
case 2:
metadata = 3;
break;
case 3:
metadata = 2;
break;
case 4:
metadata = 5;
break;
case 5:
metadata = 4;
break;
}
}
if(Block.blocksList[blockID] instanceof BlockStairs)
{
switch (metadata)
@ -443,7 +483,26 @@ public class SchematicLoader
}
break;
case WEST_DOOR_METADATA:
if (blockID == Block.hopperBlock.blockID)
{
switch (metadata)
{
case 2:
metadata = 4;
break;
case 3:
metadata = 5;
break;
case 4:
metadata = 3;
break;
case 5:
metadata = 2;
break;
}
}
if(Block.blocksList[blockID] instanceof BlockStairs)
{
@ -588,14 +647,8 @@ public class SchematicLoader
case 13:
metadata = 10;
break;
}
}
else if(Block.blocksList[blockID] instanceof BlockRedstoneRepeater ||Block.blocksList[blockID] instanceof BlockDoor ||blockID== Block.tripWireSource.blockID||Block.blocksList[blockID] instanceof BlockComparator)
{
switch (metadata)
@ -648,34 +701,16 @@ public class SchematicLoader
case 12:
metadata = 15;
break;
}
}
break;
case 3:
case NORTH_DOOR_METADATA:
/**
* this is the default case- never need to change anything here
*
*/
break;
}
}
return metadata;
}

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;
}
@ -43,6 +46,19 @@ public class BlockDimWall extends Block
}
}
@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)
{
this.blockIcon[0] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2());

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));