mirror of
https://github.com/LeavesMC/Leaves.git
synced 2026-01-04 15:41:31 +00:00
* feat: use spawn invulnerable time * refactor: rename patch * refactor: rebuild patch
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
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 ecbd894eefe86b28341d5b91112f6736abf4ac4b..39d696073da5d49f4606b52327c9f5b32b42fa07 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
|
||||
private ChatVisiblity chatVisibility = ChatVisiblity.FULL;
|
||||
public ParticleStatus particleStatus = ParticleStatus.ALL;
|
||||
private boolean canChatColor = true;
|
||||
@@ -749,6 +750,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
||||
this.resetOperationCountPerTick(); // Leaves - player operation limiter
|
||||
this.gameMode.tick();
|
||||
this.wardenSpawnTracker.tick();
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.oldMC.spawnInvulnerableTime && this.invulnerableTime > 0) --this.spawnInvulnerableTime; // Leaves - spawn invulnerable time
|
||||
if (this.invulnerableTime > 0) {
|
||||
this.invulnerableTime--;
|
||||
}
|
||||
@@ -1183,6 +1185,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))
|
||||
@@ -278,6 +278,9 @@ public final class LeavesConfig {
|
||||
@GlobalConfig("disable-LivingEntity-ai-step-alive-check")
|
||||
public boolean disableLivingEntityAiStepAliveCheck = false;
|
||||
|
||||
@GlobalConfig("spawn-invulnerable-time")
|
||||
public boolean spawnInvulnerableTime = false;
|
||||
|
||||
@GlobalConfig("fix-fortress-mob-spawn")
|
||||
public boolean fixFortressMobSpawn = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user