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

The way foods are handled right now in Minecraft is that whenever the food heal or saturation of an ItemStack are needed, the Item type of the stack is asked which values this ItemStack has. Most current food items in the game extend ItemFood, which has some extra fields (mostly private and final, but ATs can fix that) to store these values and return them in the methods designated for this purpose (e.g. ItemFood#getSaturationModifier(Lnet/minecraft/item/ItemStack;)F).

I want to make these methods return a modified value for all types that extend ItemFood and either leave these methods alone or override them is such a way that uses its super's return value. If it overrides the method and doesn't use the super, then the coder of that type has decided that their food has special behaviour and I respect that.

 

I know of a solution that uses mechanics too hacky for Lex.

 

As such, my question is whether there is a way to achieve this effect in all (or most) queries for the saturation of the ItemStack by standard means supported by Forge?

This does not only include the player eating, which could be easily handled by catching an event, but also more technical usages, such as the culinary generator from ExU, the food-eating flower (which nobody remembers the name of) from Botania, or AppleCore's foodstats display in the tooltip. Specific solutions for these three cases are not what I'm after, something general would be great.

 

I have been only talking about saturation in this example, but take it as what it is (an example). This question extends on all food-ish traits, so saturation, healAmount, and also maxItemUseDuration (which affects the speed of eating in this case, although the culinary generator, the flower and AppleCore will ignore this value).

 

I honestly don't think there is a way to something this general/universal with the infrastructure Forge provides, but we'll see.

Edited by HashtagShell
Fixed that for you -.- ~Lex; Fixed OOC because Lex deleted a part ~Hash

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.