9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-23 16:59:23 +00:00
Files
Gale/patches/server/0084-Prevent-random-strolling-into-non-ticking-chunks.patch
2022-11-30 20:55:38 +01:00

49 lines
2.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MartijnMuijsers <martijnmuijsers@live.nl>
Date: Wed, 30 Nov 2022 20:38:15 +0100
Subject: [PATCH] Prevent random strolling into non-ticking chunks
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
This patch is based on the following patch:
"Don't wander into non-ticking chunks"
By: PureGero <puregero@gmail.com>
As part of: MultiPaper (https://github.com/MultiPaper/MultiPaper)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RandomStrollGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RandomStrollGoal.java
index 216929c838446c3c14d9b9906ffa625ef35fcbc8..2c728037c561a834cb3ec485655c904d2e78430e 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/RandomStrollGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/RandomStrollGoal.java
@@ -2,6 +2,9 @@ package net.minecraft.world.entity.ai.goal;
import java.util.EnumSet;
import javax.annotation.Nullable;
+
+import net.minecraft.core.BlockPos;
+import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.PathfinderMob;
import net.minecraft.world.entity.ai.util.DefaultRandomPos;
import net.minecraft.world.phys.Vec3;
@@ -49,7 +52,7 @@ public class RandomStrollGoal extends Goal {
}
Vec3 vec3 = this.getPosition();
- if (vec3 == null) {
+ if (vec3 == null || (!this.mob.level.galeConfig().gameplayMechanics.entitiesCanRandomStrollIntoNonTickingChunks && !((ServerLevel) this.mob.level).isPositionEntityTicking(new BlockPos(vec3)))) { // Gale - MultiPaper - prevent random strolling into non-ticking chunks
return false;
} else {
this.wantedX = vec3.x;
diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
index 4c499898191b2017508b9550e5f769f2d0c97c59..9b4cebdfb75e1272417d207771807e9951badf70 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
@@ -248,6 +248,7 @@ public class GaleWorldConfiguration extends ConfigurationPart {
public boolean arrowMovementResetsDespawnCounter = true; // Gale - Purpur - make arrow movement resetting despawn counter configurable
public boolean hideFlamesOnEntitiesWithFireResistance = false; // Gale - Slice - hide flames on entities with fire resistance
+ public boolean entitiesCanRandomStrollIntoNonTickingChunks = true; // Gale - MultiPaper - prevent random strolling into non-ticking chunks
public Fixes fixes;
public class Fixes extends ConfigurationPart {