make a small fix to fortitude
This commit is contained in:
@@ -31,9 +31,16 @@ public class ServerboundSpendPointPacket {
|
||||
ServerPlayer player = context.getSender();
|
||||
if (player == null) return;
|
||||
player.getCapability(PlayerStatsProvider.PLAYER_STATS).ifPresent(stats -> {
|
||||
float previousMaxHealth = player.getMaxHealth();
|
||||
boolean success = stats.spendPoints(attribute);
|
||||
if (success) {
|
||||
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();
|
||||
PacketHandler.INSTANCE.send(
|
||||
PacketDistributor.PLAYER.with(() -> player),
|
||||
@@ -44,4 +51,4 @@ public class ServerboundSpendPointPacket {
|
||||
});
|
||||
context.setPacketHandled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user