-
Notifications
You must be signed in to change notification settings - Fork 24
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
Crashing when paired with Oversaturation #124
Comments
Overloading FoodStats will not be compatible with AppleCore (and with any other mods that overload FoodStats). Instead, when you detect AppleCore is installed, you should use AppleCore's events to modify the saturation like so: @SubscribeEvent
public void getFoodValues(FoodEvent.GetPlayerFoodValues event)
{
int maxHunger = AppleCoreAPI.accessor.getMaxHunger(event.player);
int curHunger = event.player.getFoodStats().getFoodLevel();
int extraSaturation = event.foodStats.hunger - (maxHunger - curHunger);
if (extraSaturation > 0) {
int newHunger = maxHunger - curHunger;
float newSaturationModifier = event.foodValues.saturationModifier + extraSaturation;
event.foodValues = new FoodValues(newHunger, newSaturationModifier);
}
} Note: the above should be in its own class that is only loaded when See here for how to include the AppleCore API in your dev environment. |
Actually, I missed that your mod removes the maxSaturation == currentHunger limitation, so instead you'll need to use the method outlined here: TheRandomLabs/RandomTweaks#18 |
I'm the Oversaturation dev. I'm modifying FoodStats, which is causing some players who use both this mod and my mod to crash when they eat food. However, in the dev environment, I'm experiencing a full-on crash when I load the world. Do you have any information on stopping this?
Here's my mod: https://github.com/truenachtara/Oversaturation
My dev environment crash: https://pastebin.com/Sw9XdLaC
An issue report detailing a player experiencing this issue in-game (contains crash report): Cazsius/Spice-of-Life-Carrot-Edition#32
The text was updated successfully, but these errors were encountered: