3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00
Paper/patches/server/0290-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch

37 Zeilen
1.8 KiB
Diff

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 24 Mar 2019 01:01:32 -0400
Subject: [PATCH] Only count Natural Spawned mobs towards natural spawn mob
limit
This resolves the super common complaint about mobs not spawning.
This was ultimately a flaw in the vanilla count algorithim that allows
spawners and other misc mobs to count against the mob limit, which are
not bounded, and can prevent the entire world from spawning new.
I believe Bukkits changes around persistence may of actually made it
worse than vanilla.
This should fully solve all of the issues around it so that only natural
influences natural spawns.
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
2024-10-23 15:02:51 +02:00
index be2412ef8f8c331a881e442577cf05aec43f52bb..485c6044d603f15878f9413a644a538dab68db3e 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
2024-10-23 15:02:51 +02:00
@@ -87,6 +87,13 @@ public final class NaturalSpawner {
2021-06-11 14:02:28 +02:00
MobCategory enumcreaturetype = entity.getType().getCategory();
if (enumcreaturetype != MobCategory.MISC) {
+ // Paper start - Only count natural spawns
2023-06-07 23:35:19 +02:00
+ if (!entity.level().paperConfig().entities.spawning.countAllMobsForSpawning &&
2021-06-11 14:02:28 +02:00
+ !(entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL ||
+ entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) {
+ continue;
+ }
+ // Paper end - Only count natural spawns
2021-06-11 14:02:28 +02:00
BlockPos blockposition = entity.blockPosition();
2021-11-24 06:44:21 +01:00
chunkSource.query(ChunkPos.asLong(blockposition), (chunk) -> {