Posted February 14, 20178 yr 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 February 14, 20178 yr 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.