Paper/patches/removed/1.17/No longer needed/0114-Chunk-registration-fixes.patch
2021-06-14 19:54:17 -07:00

25 lines
1.3 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
No longer relevant in 1.17
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) {