yeelp / Scaling-Feast

A simple, balanced way to increase your maximum hunger in Minecraft over the course of a world.
MIT License
0 stars 1 forks source link

New attribute: scalingfeast.maxHunger #73

Closed James103 closed 4 years ago

James103 commented 4 years ago

For packmakers that want to use Scaling Feast as a way to modify a player's max hunger based on the equipment they're wearing, there is currently no easy way to do that. The HungerTweaker method mods.hungertweaker.Hunger.setMaxHunger(IData) may override any other values that may have been set for max hunger, including those from Scaling Feast itself.

To change that, I propose a attribute, as follows:

Alternate implementation, assuming the attribute is just one modifier for max hunger:

This attribute can be used for a variety of purposes, especially in armor and tools (some of which can grant you max hunger or reduce it), but also in many other places as pack makers see fit. If this attribute is implemented, then the Hunger Plus/Minus potion effect should modify the attribute.

This is how the attribute would look like in-game as an example: image

Unlike other attributes, things like eating Hearty Shanks and starving should change the base value of the attribute for that player. For example, if you eat 10 Hearty Shanks, the base value of scalingfeast.maxHunger increases to 40 for you only, whereas if you starve yourself for 30 HP of damage, the base value of scalingfeast.maxHunger becomes 10 for you only. Other methods of changing max hunger, like the Spice of Life and Spice of Life Carrot Edition, and Hunger Plus/Minus, just set some modifiers on your max hunger.

SonicX8000 commented 4 years ago

Ooooo, this would also make it usable with Quality Tools as well if it were an attribute.

James103 commented 4 years ago

@Z-Tunic Same for scalingfeast.exhaustionRate as well, see #74. Imagine if you had to pick between a pickaxe that was slow but that wasn't exhausting at all or a pickaxe that was fast but very exhausting to use, or pick between a set of armor that gave you a lot of max hunger but was otherwise poor, or a set of armor that was really good but that reduces your max hunger.

yeelp commented 4 years ago

This is also a good idea, but the way it is currently described, it may require rewriting the current FoodCap capability to be an attribute instead, which I'm not a fan of. It probably would require me rewriting other portions of the code too. I'd really like to avoid bumping to a version 2.0 if possible, even if the benefits are numerous.

Instead, this attribute will be read as a modifier which gets applied to the capability, much like everything else (Hunger Plus/Minus etc). The resulting effect should be the same (as this modifies max hunger by addition or subtraction, so the order this is done in doesn't matter), the only difference would be if you were reading the attribute in a script. Hopefully I can expose some methods in my API that should allow the user to get the correct value they need.