Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.