From df8397c79440f0b4ed19cd12bb82ced2b22ace72 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Mon, 30 Jun 2025 21:44:33 +0800 Subject: [PATCH] Fix bot invulnerable --- .../features/0125-Spawn-invulnerable-time.patch | 6 +++--- .../src/main/java/org/leavesmc/leaves/bot/ServerBot.java | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/leaves-server/minecraft-patches/features/0125-Spawn-invulnerable-time.patch b/leaves-server/minecraft-patches/features/0125-Spawn-invulnerable-time.patch index 45dd247b..a00bd132 100644 --- a/leaves-server/minecraft-patches/features/0125-Spawn-invulnerable-time.patch +++ b/leaves-server/minecraft-patches/features/0125-Spawn-invulnerable-time.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Spawn invulnerable time diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index d4984c919a88fa930dfec823cd9b471fa47f3565..9920af965a661f9dc56e5bcd9911de7976134748 100644 +index b2bb4a2c1ba2e924f380f69365ce7384db21eed6..2521f6aff4479710ab10c7df5031f6af273fce64 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; // Leaves - spawn invulnerable time ++ protected int spawnInvulnerableTime = 60; // Leaves - spawn invulnerable time private ChatVisiblity chatVisibility = ChatVisiblity.FULL; public ParticleStatus particleStatus = ParticleStatus.ALL; private boolean canChatColor = true; @@ -24,7 +24,7 @@ index d4984c919a88fa930dfec823cd9b471fa47f3565..9920af965a661f9dc56e5bcd9911de79 if (this.invulnerableTime > 0) { this.invulnerableTime--; } -@@ -1185,6 +1187,13 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -1189,6 +1191,13 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc if (this.isInvulnerableTo(level, damageSource)) { return false; } else { diff --git a/leaves-server/src/main/java/org/leavesmc/leaves/bot/ServerBot.java b/leaves-server/src/main/java/org/leavesmc/leaves/bot/ServerBot.java index ac5fa319..d2c49f4b 100644 --- a/leaves-server/src/main/java/org/leavesmc/leaves/bot/ServerBot.java +++ b/leaves-server/src/main/java/org/leavesmc/leaves/bot/ServerBot.java @@ -130,6 +130,7 @@ public class ServerBot extends ServerPlayer { if (this.invulnerableTime > 0) { this.invulnerableTime--; } + if (this.spawnInvulnerableTime > 0) --this.spawnInvulnerableTime; // Leaves - spawn invulnerable time // copy ServerPlayer end if (this.getConfigValue(Configs.SPAWN_PHANTOM)) {