mirror of
https://github.com/PaperMC/Folia.git
synced 2025-04-23 04:39:19 +08:00
Additionally remove Mob target if the target is removed
If the target is removed, then it is possible that using the CraftEntity could retrieve a teleported entity. This would cause the Mob to be removed when getHandle() is invoked. Fixes https://github.com/PaperMC/Folia/issues/117
This commit is contained in:
parent
bd72070fb9
commit
9ae65d1b3e
@ -17872,7 +17872,7 @@ index e11d7283662834047b2ff81a2fd25a4263792deb..40dd667bacd296a3a329391dc87a5713
|
|||||||
|
|
||||||
while (!flag2 && blockposition.getY() > world.getMinBuildHeight()) {
|
while (!flag2 && blockposition.getY() > world.getMinBuildHeight()) {
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
index e2a25c29ec74147b3e66aa0b3deb85a8f6ee53a5..a8b23b1594d2b39568c68c93a8a1b936457672bc 100644
|
index e2a25c29ec74147b3e66aa0b3deb85a8f6ee53a5..a21edc7df32a59a6cb1af3865d2ce35f72cf8afc 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
@@ -134,6 +134,14 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
@@ -134,6 +134,14 @@ public abstract class Mob extends LivingEntity implements Targeting {
|
||||||
@ -17895,7 +17895,7 @@ index e2a25c29ec74147b3e66aa0b3deb85a8f6ee53a5..a8b23b1594d2b39568c68c93a8a1b936
|
|||||||
@Override
|
@Override
|
||||||
public LivingEntity getTarget() {
|
public LivingEntity getTarget() {
|
||||||
+ // Folia start - region threading
|
+ // Folia start - region threading
|
||||||
+ if (!io.papermc.paper.util.TickThread.isTickThreadFor(this.target)) {
|
+ if (this.target != null && (!io.papermc.paper.util.TickThread.isTickThreadFor(this.target) || this.target.isRemoved())) {
|
||||||
+ this.target = null;
|
+ this.target = null;
|
||||||
+ return null;
|
+ return null;
|
||||||
+ }
|
+ }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user