mirror of
https://github.com/PaperMC/Folia.git
synced 2025-04-23 04:39:19 +08:00
Only thread-check addEffect for entities in the world
Resolves possible crashes when adding effects before adding to the world or when adding from the worldgen threads.
This commit is contained in:
parent
bff0370b70
commit
6e317fd38a
@ -18760,7 +18760,7 @@ index b38c4cbcf0405d82c7b6e018e80a3174e460c1a4..5a71b5a37a55baea204821aba734d53d
|
|||||||
public void unsetRemoved() {
|
public void unsetRemoved() {
|
||||||
this.removalReason = null;
|
this.removalReason = null;
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
index a189461330a4d427a7450d504ef13de3605497e3..c52203f828f13f407c3878e73687a10a3f2bee55 100644
|
index a189461330a4d427a7450d504ef13de3605497e3..2d5f18322ed9d82eecef69c0a04c5d4358004df0 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
@@ -277,6 +277,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -277,6 +277,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
@ -18820,7 +18820,7 @@ index a189461330a4d427a7450d504ef13de3605497e3..c52203f828f13f407c3878e73687a10a
|
|||||||
|
|
||||||
public boolean addEffect(MobEffectInstance mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause) {
|
public boolean addEffect(MobEffectInstance mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause) {
|
||||||
- // org.spigotmc.AsyncCatcher.catchOp("effect add"); // Spigot // Paper - move to API
|
- // org.spigotmc.AsyncCatcher.catchOp("effect add"); // Spigot // Paper - move to API
|
||||||
+ io.papermc.paper.util.TickThread.ensureTickThread(this, "Cannot add effects to entities asynchronously"); // Folia - region threading
|
+ if (!this.hasNullCallback()) io.papermc.paper.util.TickThread.ensureTickThread(this, "Cannot add effects to entities asynchronously"); // Folia - region threading
|
||||||
if (this.isTickingEffects) {
|
if (this.isTickingEffects) {
|
||||||
this.effectsToProcess.add(new ProcessableEffect(mobeffect, cause));
|
this.effectsToProcess.add(new ProcessableEffect(mobeffect, cause));
|
||||||
return true;
|
return true;
|
||||||
|
@ -22,7 +22,7 @@ index aa42c1a05f12a614c0a7553d52efa1137b9363f9..817f79bfca1aec161cb4635b9c7a8e21
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
index c52203f828f13f407c3878e73687a10a3f2bee55..f185aac0a944d561d394aa6a3907ec4999996686 100644
|
index 2d5f18322ed9d82eecef69c0a04c5d4358004df0..414c72d630b1464ed4f3bc294ae0a3b265ecd3e8 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
@@ -4284,6 +4284,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -4284,6 +4284,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user