mirror of
https://github.com/PaperMC/Folia.git
synced 2025-04-22 20:29:19 +08:00
Add thread check to YieldJobSite
We cannot yield the job site if it is outside of the current region. Fixes https://github.com/PaperMC/Folia/issues/316
This commit is contained in:
parent
b54ba0d75b
commit
35b98633ba
@ -0,0 +1,17 @@
|
|||||||
|
--- a/net/minecraft/world/entity/ai/behavior/YieldJobSite.java
|
||||||
|
+++ b/net/minecraft/world/entity/ai/behavior/YieldJobSite.java
|
||||||
|
@@ -33,7 +_,13 @@
|
||||||
|
} else if (villager.getVillagerData().getProfession() != VillagerProfession.NONE) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
- BlockPos blockPos = instance.<GlobalPos>get(potentialJobSite).pos();
|
||||||
|
+ // Folia start - region threading
|
||||||
|
+ GlobalPos globalPos = instance.get(potentialJobSite);
|
||||||
|
+ BlockPos blockPos = globalPos.pos();
|
||||||
|
+ if (globalPos.dimension() != level.dimension() || !ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(level, blockPos)) {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ // Folia end - region threading
|
||||||
|
Optional<Holder<PoiType>> type = level.getPoiManager().getType(blockPos);
|
||||||
|
if (type.isEmpty()) {
|
||||||
|
return true;
|
Loading…
x
Reference in New Issue
Block a user