MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / onItemUse

Method onItemUse

src/main/java/net/minecraft/item/ItemLead.java:27–47  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

25 * @param side The side being right-clicked
26 */
27 public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
28 {
29 Block block = worldIn.getBlockState(pos).getBlock();
30
31 if (block instanceof BlockFence)
32 {
33 if (worldIn.isRemote)
34 {
35 return true;
36 }
37 else
38 {
39 attachToFence(playerIn, worldIn, pos);
40 return true;
41 }
42 }
43 else
44 {
45 return false;
46 }
47 }
48
49 public static boolean attachToFence(EntityPlayer player, World worldIn, BlockPos fence)
50 {

Callers

nothing calls this directly

Calls 3

attachToFenceMethod · 0.95
getBlockMethod · 0.65
getBlockStateMethod · 0.65

Tested by

no test coverage detected