c8b50d84a9
Co-authored-by: MrHua269 <mrhua269@gmail.com>
41 lines
2.2 KiB
Diff
41 lines
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
|
|
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 93c76c2faf75bf4901ecaba1e04d957d5ddddfca..2985d5e2dde049a999a39f6edbb6696332f6d822 100644
|
|
--- a/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -245,6 +245,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
|
private int lastSentFood = -99999999;
|
|
private boolean lastFoodSaturationZero = true;
|
|
public int lastSentExp = -99999999;
|
|
+ protected int spawnInvulnerableTime = 60; // Lophine - spawn invulnerable time
|
|
private ChatVisiblity chatVisibility = ChatVisiblity.FULL;
|
|
public ParticleStatus particleStatus = ParticleStatus.ALL;
|
|
private boolean canChatColor = true;
|
|
@@ -902,6 +903,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
|
this.connection.tickClientLoadTimeout();
|
|
this.gameMode.tick();
|
|
this.wardenSpawnTracker.tick();
|
|
+ if (this.spawnInvulnerableTime > 0) --this.spawnInvulnerableTime; // Lophine - spawn invulnerable time
|
|
if (this.invulnerableTime > 0) {
|
|
this.invulnerableTime--;
|
|
}
|
|
@@ -1532,6 +1534,13 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
|
return false;
|
|
}
|
|
|
|
+ // Lophine start - spawn invulnerable time
|
|
+ if (fun.bm.lophine.config.modules.function.OldFeatureConfig.spawnInvulnerableTime) {
|
|
+ if (this.spawnInvulnerableTime > 0 && !source.is(net.minecraft.tags.DamageTypeTags.BYPASSES_INVULNERABILITY)) {
|
|
+ return false;
|
|
+ }
|
|
+ }
|
|
+ // Lophine end - spawn invulnerable time
|
|
Entity entity = source.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))
|