From dea2d41b86e2a749251e12dd33439a08e9622dba Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 31 Mar 2016 19:29:06 -0400 Subject: [PATCH] Do not load chunks for light checks Should only happen for blocks on the edge that uses neighbors light level (certain blocks). In that case, there will be 3-4 other neighbors to get a light level from. --- Spigot-Server-Patches/0004-MC-Utils.patch | 14 +++++++---- ...-Do-not-load-chunks-for-light-checks.patch | 23 +++++++++++++++++++ 2 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 Spigot-Server-Patches/0125-Do-not-load-chunks-for-light-checks.patch diff --git a/Spigot-Server-Patches/0004-MC-Utils.patch b/Spigot-Server-Patches/0004-MC-Utils.patch index 46934ff0e..ba342313e 100644 --- a/Spigot-Server-Patches/0004-MC-Utils.patch +++ b/Spigot-Server-Patches/0004-MC-Utils.patch @@ -1,4 +1,4 @@ -From d7343318730a1a96448116c422161127a8bc0600 Mon Sep 17 00:00:00 2001 +From bb8dd93f486683d2a80fe0d23337f11faca44e9a Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 28 Mar 2016 20:55:47 -0400 Subject: [PATCH] MC Utils @@ -7,10 +7,10 @@ Collection of utils to help reduce NMS diff diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java new file mode 100644 -index 0000000..f76fd44 +index 0000000..3004822 --- /dev/null +++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -0,0 +1,109 @@ +@@ -0,0 +1,115 @@ +package net.minecraft.server; + +import org.bukkit.Location; @@ -119,7 +119,13 @@ index 0000000..f76fd44 + public static Location toLocation(Entity entity) { + return new Location(entity.getWorld().getWorld(), entity.locX, entity.locY, entity.locZ); + } ++ ++ public static boolean isEdgeOfChunk(BlockPosition pos) { ++ final int absX = Math.abs(pos.getX()) % 16; ++ final int absZ = Math.abs(pos.getZ()) % 16; ++ return (absX == 0 || absX == 15 || absZ == 0 || absZ == 15); ++ } +} -- -2.7.4 +2.8.0 diff --git a/Spigot-Server-Patches/0125-Do-not-load-chunks-for-light-checks.patch b/Spigot-Server-Patches/0125-Do-not-load-chunks-for-light-checks.patch new file mode 100644 index 000000000..0e645212f --- /dev/null +++ b/Spigot-Server-Patches/0125-Do-not-load-chunks-for-light-checks.patch @@ -0,0 +1,23 @@ +From ea50a2f4bccc3f86ce363e53f345acc3b434b8bb Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 31 Mar 2016 19:17:58 -0400 +Subject: [PATCH] Do not load chunks for light checks + +Should only happen for blocks on the edge that uses neighbors light level +(certain blocks). In that case, there will be 3-4 other neighbors to get a light level from. + +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index fa84bad..89103d6 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -723,6 +723,7 @@ public abstract class World implements IBlockAccess { + if (blockposition.getY() >= 256) { + blockposition = new BlockPosition(blockposition.getX(), 255, blockposition.getZ()); + } ++ if (!this.isLoaded(blockposition)) return 0; // Paper + + Chunk chunk = this.getChunkAtWorldCoords(blockposition); + +-- +2.8.0 +