Jump to content

Recommended Posts

Posted

Start event fires when the player first begins using the item.

Tick event fires each tick while the item is in use.

Stop event fires when the player stops using the item.

Finish event fires after everything to do with using the item is finished.

 

Most of this is explained in the Java docs for the events, and the rest you can gather from looking at where the events are called via the Call Hierarchy in your IDE, all of which lead to the Item class eventually.

Posted

So I'm actually still having some trouble with this event, I'm trying to make it so that when a player uses a fishing rod and it's durability goes down a counter will add 2 but it's not working does anyone know why?

 

code:

@SubscribeEvent

public void useItem(Finish event)

{

EMIEEP props = EMIEEP.get(event.entityPlayer);

if (event.entityPlayer.getHeldItem().getItem() == Items.fishing_rod && event.result.getItem().isDamaged(event.entityPlayer.getHeldItem()))

{

props.addToCounter(2.0);

System.out.println(props.getCounter());

}

}

 

 

 

 

 

 

 

 

 

 

 

Posted

So basically println() isn't working which means that the if statement isn't working I know for a fact that the IEEP counter works as I have used it for alot of other events and it works just fine here is my code, isDamaged() was like the only thing I found that checked if the item has been damaged if there is a better way to check a fishing rod after using it I'm all ears anyways here is my code:

 

@SubscribeEvent

public void useItem(Finish event)

{

EMIEEP props = EMIEEP.get(event.entityPlayer);

 

if (event.entityPlayer.getHeldItem().getItem() == Items.fishing_rod && event.result.getItem().isDamaged(event.entityPlayer.getHeldItem()))

{

props.addToCounter(2.0);

System.out.println(props.getCounter());

}

}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.