Fixed crash on right clicking on slabs with nothing in your hand

This commit is contained in:
Adubbz 2013-04-07 18:22:52 +10:00
parent 9b2eb5f2c5
commit 63f4f7abf6
13 changed files with 429 additions and 378 deletions

View File

@ -87,40 +87,44 @@ public class BlockAcaciaSlab extends BlockHalfSlab
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (par5EntityPlayer.getCurrentEquippedItem() != null)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.acaciaDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.acaciaDoubleSlab.blockID);
return true;
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.acaciaDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.acaciaDoubleSlab.blockID);
return true;
}
}
}
return false;
}
return false;
}

View File

@ -85,40 +85,44 @@ public class BlockCherrySlab extends BlockHalfSlab
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (par5EntityPlayer.getCurrentEquippedItem() != null)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.cherryDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.cherryDoubleSlab.blockID);
return true;
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.cherryDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.cherryDoubleSlab.blockID);
return true;
}
}
}
return false;
}
return false;
}

View File

@ -85,44 +85,47 @@ public class BlockDarkSlab extends BlockHalfSlab
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (par5EntityPlayer.getCurrentEquippedItem() != null)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.darkDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.darkDoubleSlab.blockID);
return true;
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.darkDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.darkDoubleSlab.blockID);
return true;
}
}
}
return false;
}
return false;
}
/**
* Returns the slab block name with step type.
*/

View File

@ -87,40 +87,44 @@ public class BlockFirSlab extends BlockHalfSlab
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (par5EntityPlayer.getCurrentEquippedItem() != null)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.firDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.firDoubleSlab.blockID);
return true;
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.firDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.firDoubleSlab.blockID);
return true;
}
}
}
return false;
}
return false;
}

View File

@ -85,40 +85,44 @@ public class BlockHolySlab extends BlockHalfSlab
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (par5EntityPlayer.getCurrentEquippedItem() != null)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.holyDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.holyDoubleSlab.blockID);
return true;
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.holyDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.holyDoubleSlab.blockID);
return true;
}
}
}
return false;
}
return false;
}

View File

@ -84,40 +84,44 @@ public class BlockMagicSlab extends BlockHalfSlab
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (par5EntityPlayer.getCurrentEquippedItem() != null)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.magicDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.magicDoubleSlab.blockID);
return true;
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.magicDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.magicDoubleSlab.blockID);
return true;
}
}
}
return false;
}
return false;
}

View File

@ -85,40 +85,44 @@ public class BlockMangroveSlab extends BlockHalfSlab
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (par5EntityPlayer.getCurrentEquippedItem() != null)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.mangroveDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.mangroveDoubleSlab.blockID);
return true;
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.mangroveDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.mangroveDoubleSlab.blockID);
return true;
}
}
}
return false;
}
return false;
}

View File

@ -84,40 +84,44 @@ public class BlockMudBrickSlab extends BlockHalfSlab
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (par5EntityPlayer.getCurrentEquippedItem() != null)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.mudBrickDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.mudBrickDoubleSlab.blockID);
return true;
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.mudBrickDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.mudBrickDoubleSlab.blockID);
return true;
}
}
}
return false;
}
return false;
}

View File

@ -85,40 +85,44 @@ public class BlockPalmSlab extends BlockHalfSlab
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (par5EntityPlayer.getCurrentEquippedItem() != null)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.palmDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.palmDoubleSlab.blockID);
return true;
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.palmDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.palmDoubleSlab.blockID);
return true;
}
}
}
return false;
}
return false;
}

View File

@ -84,40 +84,44 @@ public class BlockRedRockBrickSlab extends BlockHalfSlab
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (par5EntityPlayer.getCurrentEquippedItem() != null)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.redRockBrickDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.redRockBrickDoubleSlab.blockID);
return true;
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.redRockBrickDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.redRockBrickDoubleSlab.blockID);
return true;
}
}
}
return false;
}
return false;
}

View File

@ -84,40 +84,44 @@ public class BlockRedRockCobbleSlab extends BlockHalfSlab
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (par5EntityPlayer.getCurrentEquippedItem() != null)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.redRockCobbleDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.redRockCobbleDoubleSlab.blockID);
return true;
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.redRockCobbleDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.redRockCobbleDoubleSlab.blockID);
return true;
}
}
}
return false;
}
return false;
}

View File

@ -85,40 +85,44 @@ public class BlockRedwoodSlab extends BlockHalfSlab
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (par5EntityPlayer.getCurrentEquippedItem() != null)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.redwoodDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.redwoodDoubleSlab.blockID);
return true;
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.redwoodDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.redwoodDoubleSlab.blockID);
return true;
}
}
}
return false;
}
return false;
}

View File

@ -86,40 +86,44 @@ public class BlockWillowSlab extends BlockHalfSlab
*/
public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (par5EntityPlayer.getCurrentEquippedItem() != null)
{
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
if (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
{
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.willowDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.willowDoubleSlab.blockID);
return true;
if (par6 == 1 /*1 = top of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.willowDoubleSlab.blockID);
return true;
}
}
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{
if (par6 == 0 /*0 = bottom of the block*/)
{
if (!par5EntityPlayer.capabilities.isCreativeMode)
{
--par5EntityPlayer.getCurrentEquippedItem().stackSize;
}
world.playSoundEffect((double)((float)par2 + 0.5F), (double)((float)par3 + 0.5F), (double)((float)par4 + 0.5F), this.stepSound.getPlaceSound(), (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
world.setBlock(par2, par3, par4, BOPBlocks.willowDoubleSlab.blockID);
return true;
}
}
}
return false;
}
return false;
}