Posted October 22, 20159 yr I am currently the coder for the Realistic Animal Products and Drops Mod(http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/2389704-realistic-animal-products-and-drops-mod). I fixed my problem with the horses, but I am now having a separate small problem. How do I change sugar to be edible? I've tried overriding it, but none of the code from other problems' solutions has helped.
October 22, 20159 yr I replied to the OP's post on minecraftforum.net: Use Forge events. PlayerInteractEvent is fired when a player right clicks, check that the player is holding Sugar and the Action is RIGHT_CLICK_AIR then do what ItemFood#onItemRightClick does: check that the player can eat and then set the item in use. Item#getMaxItemUseDuration returns 0, so use the duration that ItemFood#getMaxItemUseDuration returns instead (32). PlayerUseItemEvent.Finish is fired when a player finishes using an item, check that the used item is Sugar and then do what ItemFood#onItemUseFinish does. You'll need to use FoodStats#addStats(int, float) instead of FoodStats#addStats(ItemFood, ItemStack) since the player didn't actually use an ItemFood . Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
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.