Called when a Block is right-clicked with this Item @param pos The block being right-clicked @param side The side being right-clicked
(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
| 22 | * @param side The side being right-clicked |
| 23 | */ |
| 24 | public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) |
| 25 | { |
| 26 | if (worldIn.isRemote) |
| 27 | { |
| 28 | return true; |
| 29 | } |
| 30 | else |
| 31 | { |
| 32 | pos = pos.offset(side); |
| 33 | |
| 34 | if (!playerIn.canPlayerEdit(pos, side, stack)) |
| 35 | { |
| 36 | return false; |
| 37 | } |
| 38 | else |
| 39 | { |
| 40 | if (worldIn.getBlockState(pos).getBlock().getMaterial() == Material.air) |
| 41 | { |
| 42 | worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "item.fireCharge.use", 1.0F, (itemRand.nextFloat() - itemRand.nextFloat()) * 0.2F + 1.0F); |
| 43 | worldIn.setBlockState(pos, Blocks.fire.getDefaultState()); |
| 44 | } |
| 45 | |
| 46 | if (!playerIn.capabilities.isCreativeMode) |
| 47 | { |
| 48 | --stack.stackSize; |
| 49 | } |
| 50 | |
| 51 | return true; |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | } |
nothing calls this directly
no test coverage detected