Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exhaustion is hard-capped at 40 (10 food points) #152

Closed
James103 opened this issue May 29, 2020 · 4 comments
Closed

Exhaustion is hard-capped at 40 (10 food points) #152

James103 opened this issue May 29, 2020 · 4 comments

Comments

@James103
Copy link
Contributor

James103 commented May 29, 2020

As of AppleCore-mc1.12.2-3.3.0 for MC 1.12.2, when the max exhaustion is set to the default value of 4, exhaustion is hard-capped at 40. In other words, you can only have 10 food points queued up to be deduced from your hunger bar. Exhaustion can be manually set to be more than 40, and it will deduct the proper amount of food points, but this can only be done in an NBT editor while the game is closed.

Bulk operations that have been set to cost a lot of food points, such as placing a block when the following CraftTweaker script is used, do not deduct the full amount of food points that they're supposed to deduct.

events.onBlockPlace(function(event as crafttweaker.event.BlockPlaceEvent){
	event.player.foodStats.addExhaustion(100); // Supposed to deduct 25 food points
});

Even though I have those mods loaded, I don't think it has to do with Scaling Feast 1.4.0 or AppleSkin 1.0.9. It may even be a vanilla limitation.

@squeek502
Copy link
Owner

I'm not sure I'm following. You're saying that foodStats.addExhaustion(100); will actually only set exhaustion to 40?

@yeelp
Copy link
Contributor

yeelp commented May 30, 2020

I can confirm the following behaviour. I'm the developer of Scaling Feast and I've been working on a handful of features around exhaustion and I've been getting similar results. I have a scenario set up that should set the player's exhaustion level far above 40 (280 to be exact). Saving and quitting as soon as it happens and checking NBTExplorer shows this:
exhaust
So it would seem that in my case, calling player.addExhaustion(280) seems to yield the same result as player.addExhaustion(40).

In fact, looking at the source code reveals this to be entirely correct. This is FoodStats#addExhaustion(float) on line 148 in FoodStats.class.
dundundun

So it turns out this is intentional behaviour by vanilla. Could this be patched by AppleCore?

@squeek502
Copy link
Owner

Thanks for the clarification.

Could this be patched by AppleCore?

Yep, I'm imagining a ExhaustionEvent.GetExhaustionCap event that works like ExhaustionEvent.GetMaxExhaustion.

@squeek502
Copy link
Owner

squeek502 commented May 30, 2020

With the changes to the example mod in 5ee853c to set the cap to 90 (and the 'exhausted' max to 30), the log outputs:

[14:02:18] [Server thread/INFO] [applecoreexample]: onExhausted exhaustion=90.0
[14:02:18] [Server thread/INFO] [applecoreexample]: onExhausted exhaustion=60.0
[14:02:18] [Server thread/INFO] [applecoreexample]: onExhausted exhaustion=30.0

EDIT: Released in v3.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants