Fix Mob Spawning Relative to View Distance

Changes the mob spawning algorithm to properly account for view distance and the range around players.

Needs better documentation.

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2013-06-21 17:29:54 +10:00
parent 78524cb95e
commit 19bfb10583
3 changed files with 85 additions and 7 deletions

View File

@@ -146,7 +146,13 @@
} else {
list1 = List.of();
}
@@ -425,7 +473,9 @@
@@ -420,12 +468,14 @@
ChunkPos chunkcoordintpair = chunk.getPos();
chunk.incrementInhabitedTime(timeDelta);
- if (!list1.isEmpty() && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair)) {
+ if (!list1.isEmpty() && this.level.getWorldBorder().isWithinBounds(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair, true)) { // Spigot
NaturalSpawner.spawnForChunk(this.level, chunk, spawnercreature_d, list1);
}
if (this.level.shouldTickBlocksAt(chunkcoordintpair.toLong())) {