Remove bee flower/hive position if it is too far away

This should prevent attempting to load chunks in areas outside
of the current region, and is what Vanilla logic would do eventually

Fixes https://github.com/PaperMC/Folia/issues/117
This commit is contained in:
Spottedleaf 2023-08-08 18:07:28 -07:00
parent 09ac612b2f
commit bd72070fb9

View File

@ -18304,6 +18304,34 @@ index 12a7aaeaa8b4b788b620b1985591c3b93253ccd5..5150d447c9dc2f539446749c8bee1020
} }
@Override @Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index 55026e1731e41b4e3e4c6a8fef5d96a32051a556..a5ae46b30c24812f5e3ef66eb748e92f2867add8 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -1036,6 +1036,11 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override
public boolean canBeeUse() {
+ // Folia start - region threading
+ if (Bee.this.hivePos != null && Bee.this.isTooFarAway(Bee.this.hivePos)) {
+ Bee.this.hivePos = null;
+ }
+ // Folia end - region threading
return Bee.this.hivePos != null && !Bee.this.hasRestriction() && Bee.this.wantsToEnterHive() && !this.hasReachedTarget(Bee.this.hivePos) && Bee.this.level().getBlockState(Bee.this.hivePos).is(BlockTags.BEEHIVES);
}
@@ -1152,6 +1157,11 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override
public boolean canBeeUse() {
+ // Folia start - region threading
+ if (Bee.this.savedFlowerPos != null && Bee.this.isTooFarAway(Bee.this.savedFlowerPos)) {
+ Bee.this.savedFlowerPos = null;
+ }
+ // Folia end - region threading
return Bee.this.savedFlowerPos != null && !Bee.this.hasRestriction() && this.wantsToGoToKnownFlower() && Bee.this.isFlowerValid(Bee.this.savedFlowerPos) && !Bee.this.closerThan(Bee.this.savedFlowerPos, 2);
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main/java/net/minecraft/world/entity/animal/Cat.java diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main/java/net/minecraft/world/entity/animal/Cat.java
index 90ce201bc7c47cef9bc59d7b535a7453854bac75..9c7c116a7d3570ccf5b30d55d68c420fec0d8ab5 100644 index 90ce201bc7c47cef9bc59d7b535a7453854bac75..9c7c116a7d3570ccf5b30d55d68c420fec0d8ab5 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Cat.java --- a/src/main/java/net/minecraft/world/entity/animal/Cat.java