diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f21f5a..48d3a9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ This changelog covers all recorded changes after `1.0.0`, grouped by release version from the git history. +## 2.4.3 + +- Updated Forge to `47.4.22`, Iron's Spellbooks to `3.16.2`, GeckoLib to `4.8.4`, Curios to `5.14.1`, and Caelus to `3.2.0`. +- Updated Mind & Motion and the Skill Engine development runtime addon to `1.4.5`. +- Centralized the Mind & Motion and Skill Engine versions in `gradle.properties`. + +## 2.4.2 + +- Persisted fortitude max-health modifiers so saved current health above the vanilla 20 HP limit is retained when players rejoin. +- Restored full modified health again on the first server tick after login or death respawn to prevent later lifecycle initialization from reverting it to 20 HP. + ## 2.4.1 - Fixed rejoining players with fortitude bonus health being left at the vanilla 20 HP after their increased maximum health was restored. diff --git a/build.gradle b/build.gradle index 360b187..c428ccc 100644 --- a/build.gradle +++ b/build.gradle @@ -135,7 +135,11 @@ repositories { dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" - implementation fg.deobf("net.fretux.mindmotion:mindmotion:1.4.2") + implementation fg.deobf("net.fretux.mindmotion:mindmotion:${mindmotion_version}") + + // Skill Engine is an Ascend addon, so include it in development runs without + // creating a circular mandatory dependency from Ascend back to Skill Engine. + runtimeOnly fg.deobf("net.fretux.skillengine:SkillEngine:${skillengine_version}") // Iron's Spellbooks API only compileOnly fg.deobf("io.redspace.ironsspellbooks:irons_spellbooks:${irons_spells_version}:api") diff --git a/gradle.properties b/gradle.properties index 7a33b74..0d4dba3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ minecraft_version=1.20.1 # as they do not follow standard versioning conventions. minecraft_version_range=[1.20.1] # The Forge version must agree with the Minecraft version to get a valid artifact -forge_version=47.4.0 +forge_version=47.4.22 # The Forge version range can use any version of Forge as bounds or match the loader version range forge_version_range=[47,) # The loader version range can only use the major version of Forge/FML as bounds @@ -22,10 +22,12 @@ loader_version_range=[47,) # The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"]. # Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin. # -irons_spells_version=1.20.1-3.4.0.11 -caelus_version=3.1.0+1.20 -curios_version=5.4.7+1.20.1 -geckolib_version=1.20.1:4.7.1.1 +mindmotion_version=1.4.5 +skillengine_version=1.4.5 +irons_spells_version=1.20.1-3.16.2 +caelus_version=3.2.0+1.20.1 +curios_version=5.14.1+1.20.1 +geckolib_version=1.20.1:4.8.4 player_animator_version=1.0.2-rc1+1.20 # | Channel | Version | | # |-----------|----------------------|--------------------------------------------------------------------------------| @@ -53,7 +55,7 @@ mod_name=Ascend: SbA # 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=2.4.1 +mod_version=2.4.3 # 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 diff --git a/src/main/java/net/fretux/ascend/event/PlayerEvents.java b/src/main/java/net/fretux/ascend/event/PlayerEvents.java index 1ea55f9..db01160 100644 --- a/src/main/java/net/fretux/ascend/event/PlayerEvents.java +++ b/src/main/java/net/fretux/ascend/event/PlayerEvents.java @@ -6,16 +6,22 @@ import net.fretux.ascend.player.StatEffects; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; +import net.minecraftforge.event.TickEvent; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + @Mod.EventBusSubscriber(modid = AscendMod.MODID) public class PlayerEvents { private static final ResourceLocation PLAYER_STATS_ID = ResourceLocation.fromNamespaceAndPath(AscendMod.MODID, "player_stats"); + private static final Set PENDING_FULL_HEALTH_RESTORE = new HashSet<>(); @SubscribeEvent public static void onAttachCapabilities(AttachCapabilitiesEvent event) { @@ -37,6 +43,7 @@ public class PlayerEvents { StatEffects.applyAll(event.getEntity()); if (event.isWasDeath()) { event.getEntity().setHealth(event.getEntity().getMaxHealth()); + PENDING_FULL_HEALTH_RESTORE.add(event.getEntity().getUUID()); } PlayerStatsProvider.sync(event.getEntity()); } @@ -50,8 +57,22 @@ public class PlayerEvents { if (Math.abs(healthBeforeFortitude - 20.0F) < 0.001F && event.getEntity().getMaxHealth() > healthBeforeFortitude) { event.getEntity().setHealth(event.getEntity().getMaxHealth()); + PENDING_FULL_HEALTH_RESTORE.add(event.getEntity().getUUID()); } PlayerStatsProvider.sync(event.getEntity()); } } + + @SubscribeEvent + public static void onPlayerTick(TickEvent.PlayerTickEvent event) { + Player player = event.player; + if (player.level().isClientSide + || event.phase != TickEvent.Phase.END + || !PENDING_FULL_HEALTH_RESTORE.remove(player.getUUID())) { + return; + } + StatEffects.applyAll(player); + player.setHealth(player.getMaxHealth()); + PlayerStatsProvider.sync(player); + } } diff --git a/src/main/java/net/fretux/ascend/player/StatEffects.java b/src/main/java/net/fretux/ascend/player/StatEffects.java index 10cf539..c87745a 100644 --- a/src/main/java/net/fretux/ascend/player/StatEffects.java +++ b/src/main/java/net/fretux/ascend/player/StatEffects.java @@ -112,7 +112,9 @@ public final class StatEffects { hp.removeModifier(FORTITUDE_HEALTH_UUID); if (fortitudeLevel > 0) { double healthBonus = Math.min(fortitudeLevel * 0.18d * getScaling(), 18.0d); - hp.addTransientModifier(new AttributeModifier( + // Max health must be present while Minecraft loads the player's saved Health + // value, otherwise values above the vanilla 20 HP are clamped before login. + hp.addPermanentModifier(new AttributeModifier( FORTITUDE_HEALTH_UUID, "Ascend Fortitude health bonus", healthBonus,