testserver/Unmapped-Spigot-Server-Patches/0285-Prevent-mob-spawning-f...

33 lines
2.3 KiB
Diff
Raw Normal View History

2020-06-25 14:09:55 +00:00
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/world/level/SpawnerCreature.java b/src/main/java/net/minecraft/world/level/SpawnerCreature.java
2021-03-16 15:50:45 +00:00
index 1969d1002b3182338614a2be0519fcdc385b7a44..5307488fa48ffa91446dd4457de1ce6a8f61da61 100644
--- a/src/main/java/net/minecraft/world/level/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/world/level/SpawnerCreature.java
2021-03-16 15:50:45 +00:00
@@ -176,9 +176,9 @@ public final class SpawnerCreature {
2020-06-25 14:09:55 +00:00
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;
2021-03-16 15:50:45 +00:00
@@ -207,7 +207,7 @@ public final class SpawnerCreature {
2020-06-25 14:09:55 +00:00
if (entityhuman != null) {
double d2 = entityhuman.h(d0, (double) i, d1);
2020-06-25 14:09:55 +00:00
- 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) {