From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Helvetica Volubi Date: Mon, 19 May 2025 00:06:03 +0800 Subject: [PATCH] Spawn invulnerable time diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java index 6b7c92fdf562dfa46eee8e8acbc82b02fc3226c5..144b2c9396b8162f9cce8b343d998907bf7fb5aa 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java @@ -232,6 +232,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; @@ -925,6 +926,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc this.tickClientLoadTimeout(); this.gameMode.tick(); this.wardenSpawnTracker.tick(); + if (this.spawnInvulnerableTime > 0) --this.spawnInvulnerableTime; // Lophine - spawn invulnerable time if (this.invulnerableTime > 0) { this.invulnerableTime--; } @@ -1435,6 +1437,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))