Posted December 26, 201311 yr 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
December 28, 201311 yr 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
January 3, 201411 yr An event for this would be nice, specifically for modifying vanilla behavior without reflecting vanilla items.
January 3, 201411 yr Author 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
January 15, 201411 yr 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.
January 24, 201411 yr I've created a hook for this, but it might need updating. It's over at #924 if anyone's curious.
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.