Paper/Spigot-Server-Patches/0286-Prevent-mob-spawning-from-loading-generating-chunks.patch
Mariell Hoversholm 654b792caf Updated Upstream (CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
a339310c #755: Fix NPE when calling getInventory() for virtual EnderChests
2577f9bf Increase outdated build delay
1dabfdc8 #754: Fix pre-1.16 serialized SkullMeta being broken on 1.16+, losing textures
2020-09-27 11:04:51 -04:00

33 Zeilen
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 12 Sep 2018 21:12:57 -0400
Subject: [PATCH] Prevent mob spawning from loading/generating chunks
also prevents if out of world border bounds
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index eb637c32f7a4faa99d30596c273e62ebffe74f3b..2561ba9b9c02ccb59bd7284ddfe62889911d4220 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -143,9 +143,9 @@ public final class SpawnerCreature {
StructureManager structuremanager = worldserver.getStructureManager();
ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator();
int i = blockposition.getY();
- IBlockData iblockdata = ichunkaccess.getType(blockposition);
+ IBlockData iblockdata = worldserver.getTypeIfLoadedAndInBounds(blockposition); // Paper - don't load chunks for mob spawn
- if (!iblockdata.isOccluding(ichunkaccess, blockposition)) {
+ if (iblockdata != null && !iblockdata.isOccluding(ichunkaccess, blockposition)) { // Paper - don't load chunks for mob spawn
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
int j = 0;
int k = 0;
@@ -174,7 +174,7 @@ public final class SpawnerCreature {
if (entityhuman != null) {
double d2 = entityhuman.h(d0, (double) i, d1);
- if (a(worldserver, ichunkaccess, blockposition_mutableblockposition, d2)) {
+ if (a(worldserver, ichunkaccess, blockposition_mutableblockposition, d2) && worldserver.isLoadedAndInBounds(blockposition_mutableblockposition)) { // Paper - don't load chunks for mob spawn
if (biomesettingsmobs_c == null) {
biomesettingsmobs_c = a(worldserver, structuremanager, chunkgenerator, enumcreaturetype, worldserver.random, (BlockPosition) blockposition_mutableblockposition);
if (biomesettingsmobs_c == null) {