This is a part of Leaf(https://github.com/Winds-Studio/Leaf/blob/8293ae2d0ada9df24e944f755b50e93208c1496d/leaf-server/minecraft-patches/features/0281-Lithium-faster-hash-palette.patch) Original proj license: https://github.com/Winds-Studio/Leaf/blob/8293ae2d0ada9df24e944f755b50e93208c1496d/LICENSE.md This patch is based on the following mixins: * "net/caffeinemc/mods/lithium/mixin/chunk/palette/StrategyMixin.java" By: 2No2Name <2No2Name@web.de> As part of: Lithium (https://github.com/CaffeineMC/lithium) Licensed under: LGPL-3.0-only (https://www.gnu.org/licenses/lgpl-3.0.html)
37 lines
1.8 KiB
Diff
37 lines
1.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MrHua269 <mrhua269@gmail.com>
|
|
Date: Sun, 17 May 2026 08:47:31 +0800
|
|
Subject: [PATCH] Gale Store mob counts in an array
|
|
|
|
License: MIT (https://opensource.org/licenses/MIT)
|
|
Gale - https://github.com/GaleMC/Gale
|
|
|
|
This patch is based on the following mixin:
|
|
"com/ishland/vmp/mixins/general/spawn_density_cap/MixinSpawnDensityCapperDensityCap.java"
|
|
By: ishland <ishlandmc@yeah.net>
|
|
As part of: VMP (https://github.com/RelativityMC/VMP-fabric)
|
|
Licensed under: MIT (https://opensource.org/licenses/MIT)
|
|
|
|
diff --git a/net/minecraft/world/level/LocalMobCapCalculator.java b/net/minecraft/world/level/LocalMobCapCalculator.java
|
|
index 5b3808e6ff58d350fe3fd65fb56e8f209e1b2c93..150dfb4c8465dea0139bdbf804a84ce28e8d9023 100644
|
|
--- a/net/minecraft/world/level/LocalMobCapCalculator.java
|
|
+++ b/net/minecraft/world/level/LocalMobCapCalculator.java
|
|
@@ -42,14 +42,14 @@ public class LocalMobCapCalculator {
|
|
}
|
|
|
|
private static class MobCounts {
|
|
- private final Object2IntMap<MobCategory> counts = new Object2IntOpenHashMap<>(MobCategory.values().length);
|
|
+ private final int[] counts = new int[MobCategory.values().length]; // Gale - VMP - store mob counts in an array
|
|
|
|
public void add(final MobCategory category) {
|
|
- this.counts.computeInt(category, (k, count) -> count == null ? 1 : count + 1);
|
|
+ this.counts[category.ordinal()]++; // Gale - VMP - store mob counts in an array
|
|
}
|
|
|
|
public boolean canSpawn(final MobCategory category) {
|
|
- return this.counts.getOrDefault(category, 0) < category.getMaxInstancesPerChunk();
|
|
+ return this.counts[category.ordinal()] < category.getMaxInstancesPerChunk(); // Gale - VMP - store mob counts in an array
|
|
}
|
|
}
|
|
}
|