@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand,
EnumFacing facing, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
if (stack.getCount() != 0 && player.canPlayerEdit(pos.offset(facing), facing, stack)) {
IBlockState state = world.getBlockState(pos);
if (state.getBlock() == this.singleSlab) {
AncientSlabBlock.EnumBlockHalf half = state.getValue(BlockSlab.HALF);
if ((facing == EnumFacing.UP && half == BlockSlab.EnumBlockHalf.BOTTOM || facing == EnumFacing.DOWN && half == BlockSlab.EnumBlockHalf.TOP)) {
AxisAlignedBB collisionBox = state.getSelectedBoundingBox(world, pos);
IBlockState doubleSlabState = this.doubleSlab.getDefaultState();
if (collisionBox != Block.NULL_AABB && world.checkNoEntityCollision(collisionBox.offset(pos)) && world.setBlockState(pos, doubleSlabState, 11)) {
SoundType sound = this.doubleSlab.getSoundType();
world.playSound(player, pos, sound.getPlaceSound(), SoundCategory.BLOCKS, (sound.getVolume() + 1.0F) / 2.0F, sound.getPitch() * 0.8F);
stack.shrink(1);
}
return EnumActionResult.SUCCESS;
}
}
return this.tryPlace(player, stack, world, pos.offset(facing)) ? EnumActionResult.SUCCESS : super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
} else {
return EnumActionResult.FAIL;
}
}