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) 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 (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (par6 == 1 /*1 = top of the block*/)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; 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.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); world.setBlock(par2, par3, par4, BOPBlocks.acaciaDoubleSlab.blockID);
return true; return true;
} }
} }
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{ {
if (par6 == 0 /*0 = bottom of the block*/) if (par6 == 0 /*0 = bottom of the block*/)
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (!par5EntityPlayer.capabilities.isCreativeMode)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; --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.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); world.setBlock(par2, par3, par4, BOPBlocks.acaciaDoubleSlab.blockID);
return true; return true;
}
} }
} }
return false;
} }
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) 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 (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (par6 == 1 /*1 = top of the block*/)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; 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.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); world.setBlock(par2, par3, par4, BOPBlocks.cherryDoubleSlab.blockID);
return true; return true;
} }
} }
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{ {
if (par6 == 0 /*0 = bottom of the block*/) if (par6 == 0 /*0 = bottom of the block*/)
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (!par5EntityPlayer.capabilities.isCreativeMode)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; --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.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); world.setBlock(par2, par3, par4, BOPBlocks.cherryDoubleSlab.blockID);
return true; return true;
}
} }
} }
return false;
} }
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) 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 (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (par6 == 1 /*1 = top of the block*/)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; 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.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); world.setBlock(par2, par3, par4, BOPBlocks.darkDoubleSlab.blockID);
return true; return true;
} }
} }
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{ {
if (par6 == 0 /*0 = bottom of the block*/) if (par6 == 0 /*0 = bottom of the block*/)
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (!par5EntityPlayer.capabilities.isCreativeMode)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; --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.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); world.setBlock(par2, par3, par4, BOPBlocks.darkDoubleSlab.blockID);
return true; return true;
}
} }
} }
return false;
} }
return false; return false;
} }
/** /**
* Returns the slab block name with step type. * 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) 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 (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (par6 == 1 /*1 = top of the block*/)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; 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.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); world.setBlock(par2, par3, par4, BOPBlocks.firDoubleSlab.blockID);
return true; return true;
} }
} }
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{ {
if (par6 == 0 /*0 = bottom of the block*/) if (par6 == 0 /*0 = bottom of the block*/)
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (!par5EntityPlayer.capabilities.isCreativeMode)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; --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.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); world.setBlock(par2, par3, par4, BOPBlocks.firDoubleSlab.blockID);
return true; return true;
}
} }
} }
return false;
} }
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) 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 (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (par6 == 1 /*1 = top of the block*/)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; 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.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); world.setBlock(par2, par3, par4, BOPBlocks.holyDoubleSlab.blockID);
return true; return true;
} }
} }
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{ {
if (par6 == 0 /*0 = bottom of the block*/) if (par6 == 0 /*0 = bottom of the block*/)
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (!par5EntityPlayer.capabilities.isCreativeMode)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; --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.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); world.setBlock(par2, par3, par4, BOPBlocks.holyDoubleSlab.blockID);
return true; return true;
}
} }
} }
return false;
} }
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) 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 (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (par6 == 1 /*1 = top of the block*/)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; 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.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); world.setBlock(par2, par3, par4, BOPBlocks.magicDoubleSlab.blockID);
return true; return true;
} }
} }
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{ {
if (par6 == 0 /*0 = bottom of the block*/) if (par6 == 0 /*0 = bottom of the block*/)
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (!par5EntityPlayer.capabilities.isCreativeMode)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; --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.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); world.setBlock(par2, par3, par4, BOPBlocks.magicDoubleSlab.blockID);
return true; return true;
}
} }
} }
return false;
} }
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) 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 (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (par6 == 1 /*1 = top of the block*/)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; 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.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); world.setBlock(par2, par3, par4, BOPBlocks.mangroveDoubleSlab.blockID);
return true; return true;
} }
} }
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{ {
if (par6 == 0 /*0 = bottom of the block*/) if (par6 == 0 /*0 = bottom of the block*/)
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (!par5EntityPlayer.capabilities.isCreativeMode)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; --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.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); world.setBlock(par2, par3, par4, BOPBlocks.mangroveDoubleSlab.blockID);
return true; return true;
}
} }
} }
return false;
} }
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) 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 (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (par6 == 1 /*1 = top of the block*/)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; 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.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); world.setBlock(par2, par3, par4, BOPBlocks.mudBrickDoubleSlab.blockID);
return true; return true;
} }
} }
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{ {
if (par6 == 0 /*0 = bottom of the block*/) if (par6 == 0 /*0 = bottom of the block*/)
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (!par5EntityPlayer.capabilities.isCreativeMode)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; --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.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); world.setBlock(par2, par3, par4, BOPBlocks.mudBrickDoubleSlab.blockID);
return true; return true;
}
} }
} }
return false;
} }
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) 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 (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (par6 == 1 /*1 = top of the block*/)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; 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.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); world.setBlock(par2, par3, par4, BOPBlocks.palmDoubleSlab.blockID);
return true; return true;
} }
} }
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{ {
if (par6 == 0 /*0 = bottom of the block*/) if (par6 == 0 /*0 = bottom of the block*/)
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (!par5EntityPlayer.capabilities.isCreativeMode)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; --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.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); world.setBlock(par2, par3, par4, BOPBlocks.palmDoubleSlab.blockID);
return true; return true;
}
} }
} }
return false;
} }
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) 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 (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (par6 == 1 /*1 = top of the block*/)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; 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.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); world.setBlock(par2, par3, par4, BOPBlocks.redRockBrickDoubleSlab.blockID);
return true; return true;
} }
} }
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{ {
if (par6 == 0 /*0 = bottom of the block*/) if (par6 == 0 /*0 = bottom of the block*/)
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (!par5EntityPlayer.capabilities.isCreativeMode)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; --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.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); world.setBlock(par2, par3, par4, BOPBlocks.redRockBrickDoubleSlab.blockID);
return true; return true;
}
} }
} }
return false;
} }
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) 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 (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (par6 == 1 /*1 = top of the block*/)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; 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.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); world.setBlock(par2, par3, par4, BOPBlocks.redRockCobbleDoubleSlab.blockID);
return true; return true;
} }
} }
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{ {
if (par6 == 0 /*0 = bottom of the block*/) if (par6 == 0 /*0 = bottom of the block*/)
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (!par5EntityPlayer.capabilities.isCreativeMode)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; --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.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); world.setBlock(par2, par3, par4, BOPBlocks.redRockCobbleDoubleSlab.blockID);
return true; return true;
}
} }
} }
return false;
} }
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) 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 (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (par6 == 1 /*1 = top of the block*/)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; 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.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); world.setBlock(par2, par3, par4, BOPBlocks.redwoodDoubleSlab.blockID);
return true; return true;
} }
} }
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{ {
if (par6 == 0 /*0 = bottom of the block*/) if (par6 == 0 /*0 = bottom of the block*/)
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (!par5EntityPlayer.capabilities.isCreativeMode)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; --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.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); world.setBlock(par2, par3, par4, BOPBlocks.redwoodDoubleSlab.blockID);
return true; return true;
}
} }
} }
return false;
} }
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) 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 (par5EntityPlayer.getCurrentEquippedItem().itemID == this.blockID)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (par6 == 1 /*1 = top of the block*/)
if (world.getBlockMetadata(par2, par3, par4) == 0 /*0 = Slab at bottom half*/ )
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (par6 == 1 /*1 = top of the block*/)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; 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.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); world.setBlock(par2, par3, par4, BOPBlocks.willowDoubleSlab.blockID);
return true; return true;
} }
} }
if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ ) if (world.getBlockMetadata(par2, par3, par4) == 8 /*8 = Slab at top half*/ )
{ {
if (par6 == 0 /*0 = bottom of the block*/) if (par6 == 0 /*0 = bottom of the block*/)
{ {
if (!par5EntityPlayer.capabilities.isCreativeMode) if (!par5EntityPlayer.capabilities.isCreativeMode)
{ {
--par5EntityPlayer.getCurrentEquippedItem().stackSize; --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.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); world.setBlock(par2, par3, par4, BOPBlocks.willowDoubleSlab.blockID);
return true; return true;
}
} }
} }
return false;
} }
return false; return false;
} }