PaperMC/patches/server-remapped/0112-Chunk-registration-fixes.patch
2021-06-11 14:02:28 +02:00

22 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 21 Sep 2016 22:54:28 -0400
Subject: [PATCH] Chunk registration fixes
World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is treated
Keep them consistent
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 335928d60dbfc07644ffeab366900c5e77e99d56..20650bfd10abfa010e71cfeede06c461d50d19a3 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -841,7 +841,7 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
if (entity.checkAndResetUpdateChunkPos()) {
this.getProfiler().push("chunkCheck");
int i = Mth.floor(entity.getX() / 16.0D);
- int j = Mth.floor(entity.getY() / 16.0D);
+ int j = Math.min(15, Math.max(0, Mth.floor(entity.getY() / 16.0D))); // Paper - stay consistent with chunk add/remove behavior
int k = Mth.floor(entity.getZ() / 16.0D);
if (!entity.inChunk || entity.xChunk != i || entity.yChunk != j || entity.zChunk != k) {