Closed James103 closed 4 years ago
A nice idea. I'll need to look into the attribute system, since it's completely different from capabilities but it shouldn't be too bad.
Posting this here to fish for some ideas.
So a small discovery. Attribute works perfectly as intended. However, here's a pickaxe with a +300% exhaustion rate modifier on it.
The modifier text is blue since the modifier value itself it positive. This is hardcoded, so I can't change it as far as I'm aware.
Changing it to something like "-300% Exhaustion Resistance" would make it red, but that's hardly intuitive to understand, at least to me. Maybe that's a reasonable change? Internally, the attribute would work exactly the same, just the signs of all the number would flip, which sounds error prone.
The modifier text is blue since the modifier value itself it positive. This is hardcoded, so I can't change it as far as I'm aware.
I think this is an issue occurring in vanilla Minecraft code that is more easily exposed by using Forge and a custom mod to add such an attribute, such as exhaustion rate. Could you forward that to the Forge team to see if they can allow "lower is better" attributes to be specified as such, inverting the colors used for positive (blue -> red) and negative (red -> blue) modifiers for that attribute?
I find it unlikely that they will patch this for 1.12.2 Forge as many people have simply decided to move on from 1.12.2 development-wise. It would be a nice feature to add for future versions however, so I'll still open an issue over there about it.
The better more general solution would probably be something like
public void setBeneficialTextFormatting(TextFormatting format)
Which takes a TextFormatting enum and applies it whenever beneficial modifier text is rendered. There'd be a separate method for negative modifiers to so you can do stuff like set negative colours to black and positive colours to green.
If they happen to patch this for 1.12.2 that'd be pretty cool. But in the more likely case where it's only added for future versions, I'll probably stick to the exhaustion resistance attribute instead. I can switch back to exhaustion rate when I port to the newer version that supports this.
Changing it to something like "-300% Exhaustion Resistance" would make it red, but that's hardly intuitive to understand, at least to me.
I have an alternate suggestion. Instead of "Exhaustion Rate" or "Exhaustion Resistance", my suggestion would be called "Food Efficiency"† (tentative name).
scalingfeast.foodEfficiency
†Food efficiency is a portmanteau on the word "food" and the phrase "fuel efficiency". An engine with 2x more fuel efficiency gets 2x as much work done (usually distance travelled) for the same amount of fuel as compared to an engine with 1x fuel efficiency. The stuff that organisms eat and process for energy to fuel themselves is what we call food.
I'm going revert Iron Stomach back to older behaviour. Instead of altering this attribute, it'll affect the exhaustion rate separately, as currently, there is no level at which Iron Stomach blocks all incoming exhaustion when using division.
EDIT: of course it makes sense for Soft Stomach to follow the same behaviour. I'll make them stack additively as well. That is, a Soft Stomach effect of II and an Iron Stomach effect of II will cancel each other out, and a Soft Stomach effect of III and an Iron Stomach effect of I will result in a net effect identical to Soft Stomach II.
For packmakers that want to use Scaling Feast as a way to modify a player's exhaustion rate based on the equipment they're wearing, there is currently no easy way to do that, aside from the enchantment "Fasting" (which only supports changing the exhaustion rate to a multiple of 1/5, a set that doesen't include the numbers required for all use cases). The HungerTweaker mod exposes various methods that allow editing the exhaustion rate of various actions, but there is currently no way to make it be on a per-player basis.
To change that, I propose a attribute, as follows:
scalingfeast.exhaustionRate
This attribute can be used for a variety of purposes, especially in armor and tools (some of which can increase your exhaustion rate or reduce it), but also in many other places as pack makers see fit. If this attribute is implemented, then the potion effects Iron Stomach and Soft Stomach should modify the attribute.
This is how the attribute would look like in-game as an example:![image](https://user-images.githubusercontent.com/37945304/83255532-3bd13280-a176-11ea-8a41-4ce3e0061820.png)