fix lots of levels

This commit is contained in:
Ben Kerllenevich
2023-06-09 00:49:22 -04:00
parent d20403a6d0
commit 1cfcb9f28e
43 changed files with 301 additions and 248 deletions

View File

@@ -18,7 +18,7 @@ index c2dec99102fa4c64c3c874f725cdc65845cd98d2..90828993a9dffdc27dbdbcb9fcf2fa86
// tested and confirmed via System.nanoTime()
com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> playersInRange = reducedRange ? playerchunk.playersInMobSpawnRange : playerchunk.playersInChunkTickRange;
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
index 95dc62687d10e5c6f54baadda4a725094c52c07f..2b600546990a1d564a218f3c1290e42a62175f7f 100644
index 95dc62687d10e5c6f54baadda4a725094c52c07f..84a7fb84ce97f582a898dab4982ff8e317f40e82 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
@@ -31,6 +31,12 @@ public class EatBlockGoal extends Goal {
@@ -26,8 +26,8 @@ index 95dc62687d10e5c6f54baadda4a725094c52c07f..2b600546990a1d564a218f3c1290e42a
@Override
public boolean canUse() {
+ // Purpur start
+ net.minecraft.world.level.chunk.LevelChunk chunk = this.mob.level.getChunkIfLoaded(this.mob.blockPosition());
+ if (chunk == null || chunk.playerChunk == null || !((net.minecraft.server.level.ServerLevel) this.mob.level).getChunkSource().chunkMap.anyPlayerCloseEnoughForSpawning(chunk.playerChunk, this.mob.chunkPosition(), false)) {
+ net.minecraft.world.level.chunk.LevelChunk chunk = this.mob.level().getChunkIfLoaded(this.mob.blockPosition());
+ if (chunk == null || chunk.playerChunk == null || !((net.minecraft.server.level.ServerLevel) this.mob.level()).getChunkSource().chunkMap.anyPlayerCloseEnoughForSpawning(chunk.playerChunk, this.mob.chunkPosition(), false)) {
+ return false;
+ }
+ // Purpur end