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' } sourceSets.main.resources { srcDir 'src/generated/resources' }
repositories { repositories {
mavenLocal() // REQUIRED for local Ascend mod mavenLocal()
mavenCentral() mavenCentral()
maven { maven {
@@ -86,9 +86,7 @@ repositories {
dependencies { dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
implementation fg.deobf("net.fretux.ascend:Ascend:2.0.3")
// Local Ascend mod (works because of mavenLocal())
implementation fg.deobf("net.fretux.ascend:Ascend:2.0.2")
// Iron's Spellbooks // Iron's Spellbooks
compileOnly fg.deobf("io.redspace.ironsspellbooks:irons_spellbooks:${irons_spells_version}:api") 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. # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved mod_license=All Rights Reserved
# The mod version. See https://semver.org/ # 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. # 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. # This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html # See https://maven.apache.org/guides/mini/guide-naming-conventions.html
@@ -150,12 +150,13 @@ public class PlayerTickHandler {
} }
return; return;
} }
sanity.setSanity(value + delta); float newValue = value + delta;
value = sanity.getSanity(); if (newValue <= 0 && delta < 0) {
if (value <= 0 && delta < 0) { float overflow = -newValue;
float overflow = Math.abs(value);
sanity.setSanity(0); sanity.setSanity(0);
sanity.setInsanity(Math.min(sanity.getMaxSanity(), insanity + overflow)); sanity.setInsanity(Math.min(sanity.getMaxSanity(), insanity + overflow));
} else {
sanity.setSanity(newValue);
} }
insanity = sanity.getInsanity(); insanity = sanity.getInsanity();
if (sanity.getSanity() <= 0 && insanity >= sanity.getMaxSanity()) { if (sanity.getSanity() <= 0 && insanity >= sanity.getMaxSanity()) {
@@ -168,10 +169,17 @@ public class PlayerTickHandler {
return; return;
} }
} else { } else {
sanity.setSanity(value + delta); float newValueElse = value + delta;
if (sanity.getSanity() > 0) { 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)); sanity.setInsanity(Math.max(0, insanity - 0.15f));
insanityDamageTicks.remove(player.getUUID()); insanityDamageTicks.remove(player.getUUID());
insanity = sanity.getInsanity();
} }
} }
float percent = (value / sanity.getMaxSanity()) * 100f; float percent = (value / sanity.getMaxSanity()) * 100f;