2021-06-11 12:02:28 +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/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
2021-10-05 03:14:11 +00:00
|
|
|
index ca0fcf46e67deb07a3fdb071b771a7603e0fc3d0..c8b9877135aebf1f500ab9b00d94dde0e846d247 100644
|
2021-06-11 12:02:28 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
2021-10-05 03:14:11 +00:00
|
|
|
@@ -193,9 +193,9 @@ public final class NaturalSpawner {
|
2021-06-11 12:02:28 +00:00
|
|
|
StructureFeatureManager structuremanager = world.structureFeatureManager();
|
|
|
|
ChunkGenerator chunkgenerator = world.getChunkSource().getGenerator();
|
|
|
|
int i = pos.getY();
|
|
|
|
- BlockState iblockdata = chunk.getBlockState(pos);
|
|
|
|
+ BlockState iblockdata = world.getTypeIfLoadedAndInBounds(pos); // Paper - don't load chunks for mob spawn
|
|
|
|
|
|
|
|
- if (!iblockdata.isRedstoneConductor(chunk, pos)) {
|
|
|
|
+ if (iblockdata != null && !iblockdata.isRedstoneConductor(chunk, pos)) { // Paper - don't load chunks for mob spawn
|
|
|
|
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
|
|
|
int j = 0;
|
|
|
|
int k = 0;
|
2021-10-05 03:14:11 +00:00
|
|
|
@@ -224,7 +224,7 @@ public final class NaturalSpawner {
|
2021-06-11 12:02:28 +00:00
|
|
|
if (entityhuman != null) {
|
|
|
|
double d2 = entityhuman.distanceToSqr(d0, (double) i, d1);
|
|
|
|
|
2021-06-13 04:03:02 +00:00
|
|
|
- if (NaturalSpawner.isRightDistanceToPlayerAndSpawnPoint(world, chunk, blockposition_mutableblockposition, d2)) {
|
|
|
|
+ if (world.isLoadedAndInBounds(blockposition_mutableblockposition) && NaturalSpawner.isRightDistanceToPlayerAndSpawnPoint(world, chunk, blockposition_mutableblockposition, d2)) { // Paper - don't load chunks for mob spawn
|
2021-06-11 12:02:28 +00:00
|
|
|
if (biomesettingsmobs_c == null) {
|
2021-06-13 04:03:02 +00:00
|
|
|
Optional<MobSpawnSettings.SpawnerData> optional = NaturalSpawner.getRandomSpawnMobAt(world, structuremanager, chunkgenerator, group, world.random, (BlockPos) blockposition_mutableblockposition);
|
|
|
|
|