aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0365-Backport-Prevent-mob-spawning-from-loading-generatin.patch
blob: 8ab32a6de5a548d73940defa27e68f2e04639025 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 96a29101e4eedaca172aec3ab96c880b9b3e5371 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Mon, 8 Oct 2018 17:51:52 +0100
Subject: [PATCH] Backport: Prevent mob spawning from loading/generating chunks


diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 11e69a0547..5c5bed0344 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -158,9 +158,9 @@ public final class SpawnerCreature {
                             int i2 = blockposition1.getX();
                             int j2 = blockposition1.getY();
                             int k2 = blockposition1.getZ();
-                            IBlockData iblockdata = worldserver.getType(blockposition1);
+                            IBlockData iblockdata = worldserver.getWorldBorder().isInBounds(blockposition1) ? worldserver.getTypeIfLoaded(blockposition1) : null; // Paper
 
-                            if (!iblockdata.l()) {
+                            if (iblockdata != null && !iblockdata.l()) { // Paper
                                 int l2 = 0;
                                 int i3 = 0;
 
@@ -184,7 +184,7 @@ public final class SpawnerCreature {
                                                 float f = (float) j3 + 0.5F;
                                                 float f1 = (float) l3 + 0.5F;
 
-                                                if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) {
+                                                if (worldserver.getWorldBorder().isInBounds(blockposition_mutableblockposition) && worldserver.getChunkIfLoaded(blockposition_mutableblockposition) != null && !worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) { // Paper - Prevent mob spawning from loading/generating chunks
                                                     if (biomebase_biomemeta == null) {
                                                         biomebase_biomemeta = worldserver.a(enumcreaturetype, (BlockPosition) blockposition_mutableblockposition);
                                                         if (biomebase_biomemeta == null) {
-- 
2.19.1