2019-06-14 02:27:40 +00:00
|
|
|
From 07a2f95c2ab988ea1f153d1bcedcff297bd2257d Mon Sep 17 00:00:00 2001
|
2018-09-13 01:18:31 +00:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Wed, 12 Sep 2018 21:12:57 -0400
|
|
|
|
Subject: [PATCH] Prevent mob spawning from loading/generating chunks
|
|
|
|
|
2018-09-18 01:50:02 +00:00
|
|
|
also prevents if out of world border bounds
|
2018-09-13 01:18:31 +00:00
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
2019-06-06 15:36:57 +00:00
|
|
|
index 5da0f2211b..94d7bca09d 100644
|
2018-09-13 01:18:31 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
2019-05-05 08:33:44 +00:00
|
|
|
@@ -25,9 +25,9 @@ public final class SpawnerCreature {
|
|
|
|
int l = blockposition1.getZ();
|
2018-09-13 01:18:31 +00:00
|
|
|
|
2019-05-05 08:33:44 +00:00
|
|
|
if (k >= 1) {
|
|
|
|
- IBlockData iblockdata = chunk.getType(blockposition1);
|
|
|
|
+ IBlockData iblockdata = world.getTypeIfLoadedAndInBounds(blockposition1); // Paper - don't load chunks for mob spawn
|
2018-09-15 17:46:01 +00:00
|
|
|
|
2019-05-05 08:33:44 +00:00
|
|
|
- if (!iblockdata.isOccluding(chunk, blockposition1)) {
|
|
|
|
+ if (iblockdata != null && !iblockdata.isOccluding(chunk, blockposition1)) { // Paper - don't load chunks for mob spawn
|
|
|
|
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
|
|
|
|
int i1 = 0;
|
2018-09-13 01:18:31 +00:00
|
|
|
|
2019-05-05 08:33:44 +00:00
|
|
|
@@ -52,7 +52,7 @@ public final class SpawnerCreature {
|
|
|
|
float f1 = (float) k1 + 0.5F;
|
|
|
|
EntityHuman entityhuman = world.a((double) f, (double) f1, -1.0D);
|
2019-03-24 04:59:45 +00:00
|
|
|
|
2019-05-05 08:33:44 +00:00
|
|
|
- if (entityhuman != null && entityhuman.e((double) f, (double) k, (double) f1) > 576.0D && !blockposition.a((IPosition) (new Vec3D((double) f, (double) k, (double) f1)), 24.0D)) {
|
|
|
|
+ if (entityhuman != null && entityhuman.e((double) f, (double) k, (double) f1) > 576.0D && !blockposition.a((IPosition) (new Vec3D((double) f, (double) k, (double) f1)), 24.0D) && world.isLoadedAndInBounds(blockposition_mutableblockposition)) { // Paper - don't load chunks for mob spawn
|
|
|
|
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(blockposition_mutableblockposition);
|
|
|
|
|
2019-05-14 02:20:58 +00:00
|
|
|
if (Objects.equals(chunkcoordintpair, chunk.getPos()) || world.getChunkProvider().a(chunkcoordintpair)) {
|
2018-09-13 01:18:31 +00:00
|
|
|
--
|
2019-05-05 11:32:20 +00:00
|
|
|
2.21.0
|
2018-09-13 01:18:31 +00:00
|
|
|
|