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.

[FORGE 1.12.2] How to change food sound/animation?

Featured Replies

Posted

Hello there!

 

I just created a little mod. I got a cup of coffee and when I try to drink it, it gives me the eating sound/animation.

How do I change it so it makes the sound/animation of drinking a potion?

 

EDIT/SOLUTION (Thanks V0idWa1k3r):

I added this to my food item class:

@Override
    public EnumAction getItemUseAction(ItemStack stack) {
        return EnumAction.DRINK;
    }

 

Edited by lespucci
Solution

Override Item#getItemUseAction and return whatever action you want it to be, in your case it would be DRINK

  • 1 year later...

Please note that in Minecraft 1.15+ things have changed: getItemUseAction is now called getUseAction and EnumAction is now called UseAction.

  • 7 months later...
On 4/4/2020 at 1:09 PM, Arthur Khazbs said:

Please note that in Minecraft 1.15+ things have changed: getItemUseAction is now called getUseAction and EnumAction is now called UseAction.

In 1.15+ it should work like this: (I'm uploading this just in case someone needs it)

@Override
public UseAction getUseAction(ItemStack stack) {
    return UseAction.DRINK;
}
  • Guest locked this topic
Guest
This topic is now closed to further replies.

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.