geforkt von Mirrors/Paper
c5a10665b8
Spigot still maintains some partial implementation of "tick skipping", a practice in which the MinecraftServer.currentTick field is updated not by an increment of one per actual tick, but instead set to System.currentTimeMillis() / 50. This behaviour means that the tracked tick may "skip" a tick value in case a previous tick took more than the expected 50ms. To compensate for this in important paths, spigot/craftbukkit implements "wall-time". Instead of incrementing/decrementing ticks on block entities/entities by one for each call to their tick() method, they instead increment/decrement important values, like an ItemEntity's age or pickupDelay, by the difference of `currentTick - lastTick`, where `lastTick` is the value of `currentTick` during the last tick() call. These "fixes" however do not play nicely with minecraft's simulation distance as entities/block entities implementing the above behaviour would "catch up" their values when moving from a non-ticking chunk to a ticking one as their `lastTick` value remains stuck on the last tick in a ticking chunk and hence lead to a large "catch up" once ticked again. Paper completely removes the "tick skipping" behaviour (See patch "Further-improve-server-tick-loop"), making the above precautions completely unnecessary, which also rids paper of the previous described incompatibility with non-ticking chunks.
30 Zeilen
1.5 KiB
Diff
30 Zeilen
1.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Newwind <support@newwindserver.com>
|
|
Date: Mon, 26 Aug 2024 14:01:37 +0200
|
|
Subject: [PATCH] Check dead flag in isAlive()
|
|
|
|
If a plugin sets the health of a living entity above 0 after it has already died, the entity will be "revived".
|
|
It will behave the exact same as before, except with the internal "dead" flag set, resulting in 2 behavior changes,
|
|
A: it's completely invulnerable to all damage
|
|
B: it's unable to pickup items
|
|
|
|
isValid() for these bugged entities will return true, isDead() will return false, despite the dead flag.
|
|
This patch checks that the mob isn't dead before saying its alive.
|
|
|
|
Also, even if the plugin is responsibly checking !isDead() before modifying health, on very rare circumstances
|
|
I am currently unable to replicate, these "revived" entities can still appear
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index 13c93281f6b81e88f2f54befb8e6a3e4bdabf53d..30f4f1254fc295442d72d50479e8af635f2fe983 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -2096,7 +2096,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
|
|
@Override
|
|
public boolean isAlive() {
|
|
- return !this.isRemoved() && this.getHealth() > 0.0F;
|
|
+ return !this.isRemoved() && this.getHealth() > 0.0F && !this.dead; // Paper - Check this.dead
|
|
}
|
|
|
|
@Override
|