make a small fix to fortitude

This commit is contained in:
2026-07-22 14:34:51 +02:00
parent ae339b9fff
commit 45c38d4245
2 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -135,7 +135,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.mindmotion:mindmotion:1.3.3") implementation fg.deobf("net.fretux.mindmotion:mindmotion:1.4.2")
// Iron's Spellbooks API only // Iron's Spellbooks API only
compileOnly fg.deobf("io.redspace.ironsspellbooks:irons_spellbooks:${irons_spells_version}:api") compileOnly fg.deobf("io.redspace.ironsspellbooks:irons_spellbooks:${irons_spells_version}:api")
@@ -31,9 +31,16 @@ public class ServerboundSpendPointPacket {
ServerPlayer player = context.getSender(); ServerPlayer player = context.getSender();
if (player == null) return; if (player == null) return;
player.getCapability(PlayerStatsProvider.PLAYER_STATS).ifPresent(stats -> { player.getCapability(PlayerStatsProvider.PLAYER_STATS).ifPresent(stats -> {
float previousMaxHealth = player.getMaxHealth();
boolean success = stats.spendPoints(attribute); boolean success = stats.spendPoints(attribute);
if (success) { if (success) {
StatEffects.applyAll(player); StatEffects.applyAll(player);
if ("fortitude".equals(attribute)) {
float gainedMaxHealth = player.getMaxHealth() - previousMaxHealth;
if (gainedMaxHealth > 0.0F) {
player.setHealth(Math.min(player.getHealth() + gainedMaxHealth, player.getMaxHealth()));
}
}
CompoundTag data = stats.serializeNBT(); CompoundTag data = stats.serializeNBT();
PacketHandler.INSTANCE.send( PacketHandler.INSTANCE.send(
PacketDistributor.PLAYER.with(() -> player), PacketDistributor.PLAYER.with(() -> player),