fix: refix spawnInvulnerableTime
This commit is contained in:
@@ -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
|
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
||||||
index 5596214edb14d30c9ed5af4ffdcdd2041d135c6d..6d7c3e292dd049c2cd64cf1c865ec07b498652d7 100644
|
index 5596214edb14d30c9ed5af4ffdcdd2041d135c6d..bf76bdf5f4c5a490f8de8d924b371cd98b63bfa4 100644
|
||||||
--- a/net/minecraft/server/level/ServerPlayer.java
|
--- a/net/minecraft/server/level/ServerPlayer.java
|
||||||
+++ b/net/minecraft/server/level/ServerPlayer.java
|
+++ b/net/minecraft/server/level/ServerPlayer.java
|
||||||
@@ -470,6 +470,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
@@ -221,6 +221,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||||
this.adventure$displayName = net.kyori.adventure.text.Component.text(this.getScoreboardName()); // Paper
|
private int lastSentFood = -99999999;
|
||||||
this.bukkitPickUpLoot = true;
|
private boolean lastFoodSaturationZero = true;
|
||||||
this.maxHealthCache = this.getMaxHealth();
|
public int lastSentExp = -99999999;
|
||||||
+ if (fun.bm.lophine.config.modules.misc.OldFeatureConfig.spawnInvulnerableTime) this.invulnerableTime = 60; // Leaves - spawn invulnerable time
|
+ 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 (this.spawnInvulnerableTime > 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
|
||||||
// Folia start - region threading
|
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))
|
||||||
|
|||||||
Reference in New Issue
Block a user