2021-06-11 14:02:28 +02: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
|
2022-12-07 20:22:28 +01:00
|
|
|
index 608be2b8bfff1b89855fc0bd181430d3a29a4cbb..c3d6b904f1310c93a3d5c1e5e3fab2f3476f5a48 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
2022-12-07 20:22:28 +01:00
|
|
|
@@ -170,9 +170,9 @@ public final class NaturalSpawner {
|
2022-06-08 02:15:06 +02:00
|
|
|
StructureManager structuremanager = world.structureManager();
|
2021-06-11 14:02:28 +02:00
|
|
|
ChunkGenerator chunkgenerator = world.getChunkSource().getGenerator();
|
|
|
|
int i = pos.getY();
|
|
|
|
- BlockState iblockdata = chunk.getBlockState(pos);
|
2021-12-06 00:32:02 +01:00
|
|
|
+ BlockState iblockdata = world.getBlockStateIfLoadedAndInBounds(pos); // Paper - don't load chunks for mob spawn
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
- 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;
|
2022-12-07 20:22:28 +01:00
|
|
|
@@ -201,7 +201,7 @@ public final class NaturalSpawner {
|
2021-06-11 14:02:28 +02:00
|
|
|
if (entityhuman != null) {
|
|
|
|
double d2 = entityhuman.distanceToSqr(d0, (double) i, d1);
|
|
|
|
|
2021-06-13 06:03:02 +02: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 14:02:28 +02:00
|
|
|
if (biomesettingsmobs_c == null) {
|
2021-11-24 00:06:05 +01:00
|
|
|
Optional<MobSpawnSettings.SpawnerData> optional = NaturalSpawner.getRandomSpawnMobAt(world, structuremanager, chunkgenerator, group, world.random, blockposition_mutableblockposition);
|
2021-06-13 06:03:02 +02:00
|
|
|
|