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)
| 23 | * @param side The side being right-clicked |
| 24 | */ |
| 25 | public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) |
| 26 | { |
| 27 | boolean flag = worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos); |
| 28 | BlockPos blockpos = flag ? pos : pos.offset(side); |
| 29 | |
| 30 | if (!playerIn.canPlayerEdit(blockpos, side, stack)) |
| 31 | { |
| 32 | return false; |
| 33 | } |
| 34 | else |
| 35 | { |
| 36 | Block block = worldIn.getBlockState(blockpos).getBlock(); |
| 37 | |
| 38 | if (!worldIn.canBlockBePlaced(block, blockpos, false, side, null, stack)) |
| 39 | { |
| 40 | return false; |
| 41 | } |
| 42 | else if (Blocks.redstone_wire.canPlaceBlockAt(worldIn, blockpos)) |
| 43 | { |
| 44 | --stack.stackSize; |
| 45 | worldIn.setBlockState(blockpos, Blocks.redstone_wire.getDefaultState()); |
| 46 | return true; |
| 47 | } |
| 48 | else |
| 49 | { |
| 50 | return false; |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | } |
nothing calls this directly
no test coverage detected