Jump to content

Recommended Posts

Posted

Hello I am Geert4321,

 

I am creating a mod at the moment which semi - requires an onFoodEaten event. It is not neccesary because it is just for a temporary hold and for an optional feature, but I would highly appreciate it to have that event. It might also be helpful for other modders.

 

It would make my christmas merry if you were to implement this feature. I was originally going to add it through ASM, but soon realised that I was unable to do that (as myself, so I couldnt do it, maybe others can) as when I edited the base files directley, the event wouldnt even trigger. So yeah, that is pretty much it :)

 

Greetings, Geert4321

Posted

Please look at the forge method files next time.

 

onItemUseFinish Used for when item use count runs out, ie: eating completed

 

I'm always happy to help others!

 

Java is not my main programming language but I have alot experience in PHP/HTML/JS/CSS3/C#/SQL

Posted

Yes but if you look even further, the method is protected. So I cannot access it, also it does not tell me which food the player is eating. I could go check every tick if the player is using something and then get the ItemStack but really that is a pain in the ***. So an event would be MUCH easier

  • 2 weeks later...
Posted

Try using the net.minecraftforge.event.entity.player.PlayerDestroyItemEvent. It's given an EntityPlayer (the player) and an ItemStack (the stack consumed or destroyed). It's called whenever an item is eaten or when destroyed after a rightclick event (there may be other conditions, but it's basically just called when an temstack is destroyed (size<=0)). Just check to see if the itemstack was the food you are looking for and tell it to do something.

  • 2 weeks later...

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.