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 c671adfd..45dd247b 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,36 @@ Subject: [PATCH] Spawn invulnerable time diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index d4984c919a88fa930dfec823cd9b471fa47f3565..8a622da26cff56f404b7d8b6131c27c65a31cdfe 100644 +index d4984c919a88fa930dfec823cd9b471fa47f3565..9920af965a661f9dc56e5bcd9911de7976134748 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -474,6 +474,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc - this.adventure$displayName = org.leavesmc.leaves.LeavesConfig.fix.vanillaDisplayName ? io.papermc.paper.adventure.PaperAdventure.asAdventure(this.getDisplayName()) : net.kyori.adventure.text.Component.text(this.getScoreboardName()); // Paper // Leaves - Vanilla display name - this.bukkitPickUpLoot = true; - this.maxHealthCache = this.getMaxHealth(); -+ if (org.leavesmc.leaves.LeavesConfig.modify.oldMC.spawnInvulnerableTime) this.invulnerableTime = 60; // Leaves - spawn invulnerable time - } - - @Override +@@ -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 + private ChatVisiblity chatVisibility = ChatVisiblity.FULL; + public ParticleStatus particleStatus = ParticleStatus.ALL; + private boolean canChatColor = true; +@@ -751,6 +752,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc + this.resetOperationCountPerTick(); // Leaves - player operation limiter + this.gameMode.tick(); + this.wardenSpawnTracker.tick(); ++ if (this.spawnInvulnerableTime > 0) --this.spawnInvulnerableTime; // Leaves - spawn invulnerable time + if (this.invulnerableTime > 0) { + this.invulnerableTime--; + } +@@ -1185,6 +1187,13 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc + if (this.isInvulnerableTo(level, damageSource)) { + return false; + } else { ++ // Leaves start - spawn invulnerable time ++ if (org.leavesmc.leaves.LeavesConfig.modify.oldMC.spawnInvulnerableTime) { ++ if (this.spawnInvulnerableTime > 0 && !damageSource.is(net.minecraft.tags.DamageTypeTags.BYPASSES_INVULNERABILITY)) { ++ return false; ++ } ++ } ++ // Leaves 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))