mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-28 03:19:22 +00:00
36 lines
2.1 KiB
Diff
36 lines
2.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
Date: Sun, 14 Aug 2022 00:59:42 +0800
|
|
Subject: [PATCH] Fix Paper#6045, block goal shouldn't load chunks
|
|
|
|
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
|
|
index 34f319ad09276c6f68dde449c79351de0d7d86f5..bbca34e70b1ee88ac77b0d8e319eedbffae3effb 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
|
|
@@ -119,6 +119,7 @@ public abstract class MoveToBlockGoal extends Goal {
|
|
for(int m = 0; m <= l; m = m > 0 ? -m : 1 - m) {
|
|
for(int n = m < l && m > -l ? l : 0; n <= l; n = n > 0 ? -n : 1 - n) {
|
|
mutableBlockPos.setWithOffset(blockPos, m, k - 1, n);
|
|
+ if (top.leavesmc.leaves.LeavesConfig.fixPaper6045 && !this.mob.level().hasChunkAt(mutableBlockPos)) continue; // Leaves - if this block isn't loaded, continue
|
|
if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) {
|
|
this.blockPos = mutableBlockPos;
|
|
setTargetPosition(mutableBlockPos.immutable()); // Paper
|
|
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
|
index 4abc997fbe641f9c97b31fb88314230f7eb9af04..b2e135eac3c1bc7c9486a9e38f162bd3b68c24bb 100644
|
|
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
|
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
|
@@ -262,6 +262,11 @@ public final class LeavesConfig {
|
|
}
|
|
}
|
|
|
|
+ public static boolean fixPaper6045 = true;
|
|
+ private static void fixPaper6045() {
|
|
+ fixPaper6045 = getBoolean("settings.performance.fix.fix-paper-6045", fixPaper6045);
|
|
+ }
|
|
+
|
|
public static final class WorldConfig {
|
|
|
|
public final String worldName;
|