make a small fix to fortitude
This commit is contained in:
+1
-1
@@ -135,7 +135,7 @@ repositories {
|
||||
dependencies {
|
||||
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
|
||||
compileOnly fg.deobf("io.redspace.ironsspellbooks:irons_spellbooks:${irons_spells_version}:api")
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user