mob spawn settings

This commit is contained in:
Lulu13022002 2024-12-13 21:03:19 +01:00
parent d9e895a6d4
commit 2509faa08e
No known key found for this signature in database
GPG Key ID: 491C8F0B8ACDEB01

View File

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/biome/MobSpawnSettings.java
+++ b/net/minecraft/world/level/biome/MobSpawnSettings.java
@@ -75,8 +75,40 @@
@@ -75,8 +_,40 @@
}
public static class Builder {
@ -36,9 +36,9 @@
+ }
+ // use toImmutableEnumMap collector
private final Map<MobCategory, List<MobSpawnSettings.SpawnerData>> spawners = Stream.of(MobCategory.values())
- .collect(ImmutableMap.toImmutableMap(mobCategory -> (MobCategory)mobCategory, mobCategory -> Lists.newArrayList()));
- .collect(ImmutableMap.toImmutableMap(key -> (MobCategory)key, value -> Lists.newArrayList()));
+ .collect(Maps.toImmutableEnumMap(mobCategory -> (MobCategory)mobCategory, mobCategory -> new MobList())); // Use MobList instead of ArrayList
+ // Paper end - Perf: keep track of data in a pair set to give O(1) contains calls
+ // Paper end - Perf: keep track of data in a pair set to give O(1) contains calls
private final Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> mobSpawnCosts = Maps.newLinkedHashMap();
private float creatureGenerationProbability = 0.1F;