mirror of
https://github.com/PaperMC/Folia.git
synced 2024-11-21 11:55:11 +01:00
Do not erase job site memory when not in tick thread region
The intention behind erasing the memory was to match the case where the villager would lose. However, there may not be any competitors in which case the villager would never lose. Instead, the new behavior is to behave as if the villager was not loaded. Fixes https://github.com/PaperMC/Folia/issues/64
This commit is contained in:
parent
bd96e299d4
commit
c0631fd5cd
@ -17861,16 +17861,15 @@ index a2de99709ce14303a309806c683da6b3548659c1..082b0594d5de2e952e0b2b64e76c1db3
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/PoiCompetitorScan.java b/src/main/java/net/minecraft/world/entity/ai/behavior/PoiCompetitorScan.java
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/PoiCompetitorScan.java b/src/main/java/net/minecraft/world/entity/ai/behavior/PoiCompetitorScan.java
|
||||||
index 8ec07578c1e41997a2e5ef158885ad3f4c2a31b6..6dcacfca6eb4a8a6425f1aaeb57733d29989032a 100644
|
index 8ec07578c1e41997a2e5ef158885ad3f4c2a31b6..003d85261bc0df871a8247c193e2b45c822b66b3 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/PoiCompetitorScan.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/PoiCompetitorScan.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/PoiCompetitorScan.java
|
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/PoiCompetitorScan.java
|
||||||
@@ -17,6 +17,12 @@ public class PoiCompetitorScan {
|
@@ -17,6 +17,11 @@ public class PoiCompetitorScan {
|
||||||
return context.group(context.present(MemoryModuleType.JOB_SITE), context.present(MemoryModuleType.NEAREST_LIVING_ENTITIES)).apply(context, (jobSite, mobs) -> {
|
return context.group(context.present(MemoryModuleType.JOB_SITE), context.present(MemoryModuleType.NEAREST_LIVING_ENTITIES)).apply(context, (jobSite, mobs) -> {
|
||||||
return (world, entity, time) -> {
|
return (world, entity, time) -> {
|
||||||
GlobalPos globalPos = context.get(jobSite);
|
GlobalPos globalPos = context.get(jobSite);
|
||||||
+ // Folia start - region threading
|
+ // Folia start - region threading
|
||||||
+ if (globalPos.dimension() != world.dimension() || !io.papermc.paper.util.TickThread.isTickThreadFor(world, globalPos.pos())) {
|
+ if (globalPos.dimension() != world.dimension() || !io.papermc.paper.util.TickThread.isTickThreadFor(world, globalPos.pos())) {
|
||||||
+ entity.getBrain().eraseMemory(MemoryModuleType.JOB_SITE);
|
|
||||||
+ return true;
|
+ return true;
|
||||||
+ }
|
+ }
|
||||||
+ // Folia end - region threading
|
+ // Folia end - region threading
|
||||||
|
Loading…
Reference in New Issue
Block a user