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

Method onItemUse

src/main/java/net/minecraft/item/ItemFirework.java:22–40  ·  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

20 * @param side The side being right-clicked
21 */
22 public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
23 {
24 if (!worldIn.isRemote)
25 {
26 EntityFireworkRocket entityfireworkrocket = new EntityFireworkRocket(worldIn, (float)pos.getX() + hitX, (float)pos.getY() + hitY, (float)pos.getZ() + hitZ, stack);
27 worldIn.spawnEntityInWorld(entityfireworkrocket);
28
29 if (!playerIn.capabilities.isCreativeMode)
30 {
31 --stack.stackSize;
32 }
33
34 return true;
35 }
36 else
37 {
38 return false;
39 }
40 }
41
42 /**
43 * allows items to add custom lines of information to the mouseover description

Callers

nothing calls this directly

Calls 4

getXMethod · 0.65
getYMethod · 0.65
getZMethod · 0.65
spawnEntityInWorldMethod · 0.45

Tested by

no test coverage detected