mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-28 19:39:17 +00:00
* rebase * optimize LivingEntity#travel * cleanup * Replace fluid height map * reuse array list in Entity#collide * cleanup * fix fire and liquid collision shape * fix checkInside * inline betweenClosed * cleanup * optimize getOnPos * optimize equals in getOnPos * update mainSupportingBlockPos on dirty * cleanup * rename * merge same patch * rebase and remove properly * [ci skip] cleanup * rebase and rebuild * fix async locator * remove async locator * cleanup * rebase --------- Co-authored-by: Taiyou06 <kaandindar21@gmail.com>
29 lines
1.6 KiB
Diff
29 lines
1.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: hayanesuru <hayanesuru@outlook.jp>
|
|
Date: Wed, 4 Jun 2025 20:54:03 +0900
|
|
Subject: [PATCH] throttle mob spawning
|
|
|
|
|
|
diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java
|
|
index f0b78c6d89cd3010a0b8e9fbe760f615d7b8771e..3a54fa25bf491902235392168a00c17378e01c0d 100644
|
|
--- a/net/minecraft/world/level/NaturalSpawner.java
|
|
+++ b/net/minecraft/world/level/NaturalSpawner.java
|
|
@@ -217,6 +217,17 @@ public final class NaturalSpawner {
|
|
// Paper start - Optional per player mob spawns
|
|
final boolean canSpawn;
|
|
int maxSpawns = Integer.MAX_VALUE;
|
|
+ // Leaf start - throttle mob spawning
|
|
+ if (org.dreeam.leaf.config.modules.opt.ThrottleNaturalMobSpawning.enabled) {
|
|
+ int spawnChance = org.dreeam.leaf.config.modules.opt.ThrottleNaturalMobSpawning.spawnChance[mobCategory.ordinal()];
|
|
+ long failedAttempt = org.dreeam.leaf.config.modules.opt.ThrottleNaturalMobSpawning.failedAttempts[mobCategory.ordinal()];
|
|
+ if (failedAttempt >= 0L
|
|
+ && chunk.failedSpawnAttempts[mobCategory.ordinal()] >= failedAttempt
|
|
+ && (level.random.nextInt() & Integer.MAX_VALUE) >= spawnChance) {
|
|
+ continue;
|
|
+ }
|
|
+ }
|
|
+ // Leaf end - throttle mob spawning
|
|
if (level.paperConfig().entities.spawning.perPlayerMobSpawns) {
|
|
// Copied from getFilteredSpawningCategories
|
|
int limit = mobCategory.getMaxInstancesPerChunk();
|