mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-22 00:19:33 +00:00
36 lines
2.2 KiB
Diff
36 lines
2.2 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 26bf383caea68834c654b25653ced9017f1b1b22..71e3c7fc5c071e83dfeca6954771e55946b7d533 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 51130d4d0f95af0d3ee508e83e69697783c31106..f157ee3c0b37fab427c9ce97ac3d28ddca831f8b 100644
|
|
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
|
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
|
|
@@ -238,6 +238,11 @@ public final class LeavesConfig {
|
|
asyncEntityTracker = getBoolean("settings.performance.async-entity-tracker", asyncEntityTracker);
|
|
}
|
|
|
|
+ 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;
|