diff --git a/src/main/java/ru/bclib/api/biomes/BiomeAPI.java b/src/main/java/ru/bclib/api/biomes/BiomeAPI.java index e2fffc82..41a4f745 100644 --- a/src/main/java/ru/bclib/api/biomes/BiomeAPI.java +++ b/src/main/java/ru/bclib/api/biomes/BiomeAPI.java @@ -576,8 +576,8 @@ public class BiomeAPI { public static void addBiomeMobSpawn(Biome biome, EntityType entityType, int weight, int minGroupCount, int maxGroupCount) { final MobCategory category = entityType.getCategory(); MobSpawnSettingsAccessor accessor = (MobSpawnSettingsAccessor) biome.getMobSettings(); - Map> spawners = getMutableMap(accessor.bcl_getSpawners()); - List mobs = spawners.containsKey(category) ? getMutableList(spawners.get(category).unwrap()) : Lists.newArrayList(); + Map> spawners = CollectionsUtil.getMutable(accessor.bcl_getSpawners()); + List mobs = spawners.containsKey(category) ? CollectionsUtil.getMutable(spawners.get(category).unwrap()) : Lists.newArrayList(); mobs.add(new SpawnerData(entityType, weight, minGroupCount, maxGroupCount)); spawners.put(category, WeightedRandomList.create(mobs)); accessor.bcl_setSpawners(spawners); @@ -603,24 +603,11 @@ public class BiomeAPI { lists.add(Lists.newArrayList()); } } - List> list = getMutableList(lists.get(index)); + List> list = CollectionsUtil.getMutable(lists.get(index)); lists.set(index, list); return list; } - private static List getMutableList(List input) { - if (input!=null) { - System.out.println("getMutableList: " + input.getClass().getName()); - for (Class cl : input.getClass().getInterfaces()){ - System.out.println(" - " + cl.getName()); - } - } - if (/*input instanceof ImmutableList ||*/ !(input instanceof ArrayList || input instanceof LinkedList)) { - return Lists.newArrayList(input); - } - return input; - } - private static List> getFeaturesList(List>> features, Decoration step) { int index = step.ordinal(); while (features.size() <= index) { @@ -631,13 +618,6 @@ public class BiomeAPI { return mutable; } - private static Map getMutableMap(Map input) { - if (/*input instanceof ImmutableMap*/ !(input instanceof HashMap ||input instanceof EnumMap)) { - return Maps.newHashMap(input); - } - return input; - } - //inspired by net.fabricmc.fabric.impl.biome.modification.BiomeStructureStartsImpl private static Map, Multimap, ResourceKey>> getMutableStructureConfig(NoiseGeneratorSettings settings) { final StructureSettingsAccessor access = (StructureSettingsAccessor)settings.structureSettings();