Added New Dungeons and Fixed Various Minor Bugs #43

Merged
SenseiKiwi merged 13 commits from master into master 2013-07-17 07:02:10 +00:00
Showing only changes of commit 71adfa2358 - Show all commits

View File

@@ -22,37 +22,39 @@ import net.minecraft.world.World;
public class BlockDimWall extends Block public class BlockDimWall extends Block
{ {
private Icon[] blockIcon= new Icon[2]; private static final float SUPER_HIGH_HARDNESS = 10000000000000F;
public BlockDimWall(int i, int j, Material par2Material) private Icon[] blockIcon = new Icon[2];
public BlockDimWall(int blockID, int j, Material par2Material)
{ {
super(i, Material.ground); super(blockID, Material.ground);
setTickRandomly(true); setTickRandomly(true);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab); this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
} }
public float getBlockHardness(World par1World, int par2, int par3, int par4) public float getBlockHardness(World par1World, int par2, int par3, int par4)
{ {
if(par1World.getBlockMetadata(par2, par3, par4)==0) if (par1World.getBlockMetadata(par2, par3, par4) == 0)
{ {
return this.blockHardness; return this.blockHardness;
} }
else else
{ {
return 10000000000000F; return SUPER_HIGH_HARDNESS;
} }
} }
public void registerIcons(IconRegister par1IconRegister) public void registerIcons(IconRegister par1IconRegister)
{ {
this.blockIcon[0] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()); this.blockIcon[0] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2());
this.blockIcon[1] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+"perm"); this.blockIcon[1] = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2() + "perm");
} }
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public Icon getIcon(int par1, int par2) public Icon getIcon(int par1, int par2)
{ {
if(par2==1) if (par2 == 1)
{ {
return blockIcon[par2]; return blockIcon[par2];
} }
@@ -68,6 +70,7 @@ public class BlockDimWall extends Block
return metadata; return metadata;
} }
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(int unknown, CreativeTabs tab, List subItems) public void getSubBlocks(int unknown, CreativeTabs tab, List subItems)
{ {
@@ -91,49 +94,29 @@ public class BlockDimWall extends Block
/** /**
* replaces the block clicked with the held block, instead of placing the block on top of it. Shift click to disable. * replaces the block clicked with the held block, instead of placing the block on top of it. Shift click to disable.
*/ */
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
{ {
if(entityPlayer.getCurrentEquippedItem()!=null) if (entityPlayer.getCurrentEquippedItem() != null)
{ {
Item playerEquip = entityPlayer.getCurrentEquippedItem().getItem(); Item playerEquip = entityPlayer.getCurrentEquippedItem().getItem();
if(!(playerEquip instanceof ItemBlock)) if (playerEquip instanceof ItemBlock)
{
Block block = Block.blocksList[playerEquip.itemID];
if (!Block.isNormalCube(playerEquip.itemID) || block instanceof BlockContainer || block.blockID == this.blockID)
{ {
return false; return false;
} }
else if (!world.isRemote)
{ {
Block block= Block.blocksList[playerEquip.itemID]; if (!entityPlayer.capabilities.isCreativeMode)
if(!Block.isNormalCube(playerEquip.itemID))
{
return false;
}
if(block instanceof BlockContainer)
{
return false;
}
}
if(entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemBlock)
{
if(par1World.isRemote)
{
return true;
}
if(!entityPlayer.capabilities.isCreativeMode)
{ {
entityPlayer.getCurrentEquippedItem().stackSize--; entityPlayer.getCurrentEquippedItem().stackSize--;
} }
par1World.setBlock(par2, par3, par4, entityPlayer.getCurrentEquippedItem().itemID, entityPlayer.getCurrentEquippedItem().getItemDamage(),0); world.setBlock(x, y, z, entityPlayer.getCurrentEquippedItem().itemID, entityPlayer.getCurrentEquippedItem().getItemDamage(), 0);
}
return true; return true;
} }
}
else
{
return false;
} }
return false; return false;
} }