Jump to content

Event when a player gains an item


McJty

Recommended Posts

Hi all. I need to know when the player gains an item of my mod. Be it by picking it up from the ground, getting it out of a chest or anything else. I need this to register an achievement.

 

I can use ItemPickupEvent to get notified when the player picks up an item from the ground but that doesn't work for picking up from a chest or other inventory.

 

So ideally I would like to have an event that is fired when the player gains an item in his/her inventory. Is there something like that?

 

Thanks!

 

Link to comment
Share on other sites

Well, it kind of is... But at the end of the day there is no existing event that notifies you on a slot or inventory changes.

 

Currently looking at the inventory code, I cannot see an easier way to do this. Unless you hack the inventory code and add you own event in there.

I require Java, both the coffee and the code :)

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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