Paper/Spigot-Server-Patches/0292-Prevent-mob-spawning-from-loading-generating-chunks.patch
Aikar b6925c36af
Remove no longer needed undead horse leash patch
This is now default vanilla behavior

Fixes #3644
2020-06-28 04:35:41 -04:00

33 lines
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 137fa3e51390e95f5939f2251e0d170accbfb469..6426f67afb3cc3522ff79b1c8515c1f97cd2f0c1 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -144,9 +144,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;
@@ -175,7 +175,7 @@ public final class SpawnerCreature {
if (entityhuman != null) {
double d2 = entityhuman.g(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 (biomebase_biomemeta == null) {
biomebase_biomemeta = a(worldserver, structuremanager, chunkgenerator, enumcreaturetype, worldserver.random, (BlockPosition) blockposition_mutableblockposition);
if (biomebase_biomemeta == null) {