Files
MiraiMC/patches/server/0104-Don-t-wander-into-non-ticking-chunks.patch
etil2jz ac9967167c Update Upstream (Pufferfish)
Also drop merged PRs and patches replaced by the new chunk system
2022-10-13 12:48:37 +02:00

44 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: PureGero <puregero@gmail.com>
Date: Thu, 14 Apr 2022 10:58:25 +1000
Subject: [PATCH] Don't wander into non-ticking chunks
Original license: GPLv3
Original project: https://github.com/MultiPaper/MultiPaper
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..331adba3220e2e47335459a1cdd23221b3ba83b5 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 || !((ServerLevel) this.mob.level).isPositionEntityTicking(new BlockPos(vec3))) { // MultiPaper - don't wander into non-ticking chunks
return false;
} else {
this.wantedX = vec3.x;
diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java
index a51424d29ac353cf1bec4d1484db0acb63bebba5..abfaf2e12757b5607a3ac08dc5acebccdbea6770 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
@@ -138,6 +138,7 @@ public class Squid extends WaterAnimal {
}
if (!this.level.isClientSide) {
+ if ((tx != 0 || ty != 0 || tz != 0) && !((ServerLevel) this.level).isPositionEntityTicking(new BlockPos(position().add(tx, ty, tz)))) tx = ty = tz = 0; // MultiPaper - don't allow squids to wander into non-ticking chunks
this.setDeltaMovement((double) (this.tx * this.speed), (double) (this.ty * this.speed), (double) (this.tz * this.speed));
}