fixed a critical bug that made it impossible to become insane

This commit is contained in:
2025-12-11 22:02:59 +01:00
parent e5a721cb72
commit ffa3798dae
3 changed files with 17 additions and 11 deletions
+2 -4
View File
@@ -62,7 +62,7 @@ minecraft {
sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories {
mavenLocal() // REQUIRED for local Ascend mod
mavenLocal()
mavenCentral()
maven {
@@ -86,9 +86,7 @@ repositories {
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
// Local Ascend mod (works because of mavenLocal())
implementation fg.deobf("net.fretux.ascend:Ascend:2.0.2")
implementation fg.deobf("net.fretux.ascend:Ascend:2.0.3")
// Iron's Spellbooks
compileOnly fg.deobf("io.redspace.ironsspellbooks:irons_spellbooks:${irons_spells_version}:api")
+1 -1
View File
@@ -52,7 +52,7 @@ mod_name=Mind & Motion
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=1.2.0
mod_version=1.2.1
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
@@ -150,12 +150,13 @@ public class PlayerTickHandler {
}
return;
}
sanity.setSanity(value + delta);
value = sanity.getSanity();
if (value <= 0 && delta < 0) {
float overflow = Math.abs(value);
float newValue = value + delta;
if (newValue <= 0 && delta < 0) {
float overflow = -newValue;
sanity.setSanity(0);
sanity.setInsanity(Math.min(sanity.getMaxSanity(), insanity + overflow));
} else {
sanity.setSanity(newValue);
}
insanity = sanity.getInsanity();
if (sanity.getSanity() <= 0 && insanity >= sanity.getMaxSanity()) {
@@ -168,10 +169,17 @@ public class PlayerTickHandler {
return;
}
} else {
sanity.setSanity(value + delta);
if (sanity.getSanity() > 0) {
float newValueElse = value + delta;
if (newValueElse <= 0 && delta < 0) {
float overflow = -newValueElse;
sanity.setSanity(0);
sanity.setInsanity(Math.min(sanity.getMaxSanity(), insanity + overflow));
insanity = sanity.getInsanity();
} else if (newValueElse > 0) {
sanity.setSanity(newValueElse);
sanity.setInsanity(Math.max(0, insanity - 0.15f));
insanityDamageTicks.remove(player.getUUID());
insanity = sanity.getInsanity();
}
}
float percent = (value / sanity.getMaxSanity()) * 100f;