From 34cc8765c6caecd7ac7a409e1cad1da63061dc5e Mon Sep 17 00:00:00 2001 From: Helvetica Volubi Date: Tue, 24 Jun 2025 19:56:14 +0800 Subject: [PATCH] fix: fix some bugs --- .../0011-Spawn-invulnerable-time.patch | 40 +++++-------------- .../fun/bm/lophine/utils/ServerI18nUtil.java | 3 +- 2 files changed, 11 insertions(+), 32 deletions(-) diff --git a/lophine-server/minecraft-patches/features/0011-Spawn-invulnerable-time.patch b/lophine-server/minecraft-patches/features/0011-Spawn-invulnerable-time.patch index 9a4adc2..cba8439 100644 --- a/lophine-server/minecraft-patches/features/0011-Spawn-invulnerable-time.patch +++ b/lophine-server/minecraft-patches/features/0011-Spawn-invulnerable-time.patch @@ -5,36 +5,14 @@ Subject: [PATCH] Spawn invulnerable time diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index 5596214edb14d30c9ed5af4ffdcdd2041d135c6d..1a02b14cb457ba8e8c84ec1b111d3829a9c0209c 100644 +index 5596214edb14d30c9ed5af4ffdcdd2041d135c6d..6d7c3e292dd049c2cd64cf1c865ec07b498652d7 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -221,6 +221,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc - private int lastSentFood = -99999999; - private boolean lastFoodSaturationZero = true; - public int lastSentExp = -99999999; -+ private int spawnInvulnerableTime = 60; // Lophine - spawn invulnerable time - private ChatVisiblity chatVisibility = ChatVisiblity.FULL; - public ParticleStatus particleStatus = ParticleStatus.ALL; - private boolean canChatColor = true; -@@ -923,6 +924,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc - this.tickClientLoadTimeout(); - this.gameMode.tick(); - this.wardenSpawnTracker.tick(); -+ if (fun.bm.lophine.config.modules.misc.OldFeatureConfig.spawnInvulnerableTime && this.invulnerableTime > 0) --this.spawnInvulnerableTime; // Lophine - spawn invulnerable time - if (this.invulnerableTime > 0) { - this.invulnerableTime--; - } -@@ -1420,6 +1422,13 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc - if (this.isInvulnerableTo(level, damageSource)) { - return false; - } else { -+ // Lophine start - spawn invulnerable time -+ if (fun.bm.lophine.config.modules.misc.OldFeatureConfig.spawnInvulnerableTime) { -+ if (this.spawnInvulnerableTime > 0 && !damageSource.is(net.minecraft.tags.DamageTypeTags.BYPASSES_INVULNERABILITY)) { -+ return false; -+ } -+ } -+ // Lophine end - spawn invulnerable time - Entity entity = damageSource.getEntity(); - if (!( // Paper - split the if statement. If below statement is false, hurtServer would not have been evaluated. Return false. - !(entity instanceof Player player && !this.canHarmPlayer(player)) +@@ -470,6 +470,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc + this.adventure$displayName = net.kyori.adventure.text.Component.text(this.getScoreboardName()); // Paper + this.bukkitPickUpLoot = true; + this.maxHealthCache = this.getMaxHealth(); ++ if (fun.bm.lophine.config.modules.misc.OldFeatureConfig.spawnInvulnerableTime) this.invulnerableTime = 60; // Leaves - spawn invulnerable time + } + + // Folia start - region threading diff --git a/lophine-server/src/main/java/fun/bm/lophine/utils/ServerI18nUtil.java b/lophine-server/src/main/java/fun/bm/lophine/utils/ServerI18nUtil.java index 66524e0..941b02d 100644 --- a/lophine-server/src/main/java/fun/bm/lophine/utils/ServerI18nUtil.java +++ b/lophine-server/src/main/java/fun/bm/lophine/utils/ServerI18nUtil.java @@ -5,6 +5,7 @@ import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.JsonSyntaxException; import fun.bm.lophine.config.modules.optimizations.LanguageConfig; +import net.minecraft.DetectedVersion; import net.minecraft.locale.DeprecatedTranslationsInfo; import net.minecraft.locale.Language; import net.minecraft.network.chat.FormattedText; @@ -38,7 +39,7 @@ import java.util.logging.Logger; public class ServerI18nUtil { private static final Logger logger = Logger.getLogger("LangLoader"); - private static final String VERSION = "1.21.5"; + private static final String VERSION = DetectedVersion.BUILT_IN.getName(); private static final String BASE_PATH = "cache/lophine/" + VERSION + "/"; private static final String manifestUrl = "https://launchermeta.mojang.com/mc/game/version_manifest.json"; private static final String resourceBaseUrl = "https://resources.download.minecraft.net/";