BCL Biome feature adding optimisation

This commit is contained in:
paulevsGitch 2021-12-03 13:54:07 +03:00
parent 8234a1c9dc
commit db07cd1887

View file

@ -476,9 +476,16 @@ public class BiomeAPI {
* @param features array of {@link BCLFeature} to add.
*/
public static void addBiomeFeatures(Biome biome, BCLFeature... features) {
BiomeGenerationSettingsAccessor accessor = (BiomeGenerationSettingsAccessor) biome.getGenerationSettings();
List<List<Supplier<PlacedFeature>>> allFeatures = CollectionsUtil.getMutable(accessor.bclib_getFeatures());
Set<PlacedFeature> set = CollectionsUtil.getMutable(accessor.bclib_getFeatureSet());
for (BCLFeature feature: features) {
addBiomeFeature(biome, feature.getPlacedFeature(), feature.getDecoration());
List<Supplier<PlacedFeature>> featureList = getFeaturesList(allFeatures, feature.getDecoration());
featureList.add(() -> feature.getPlacedFeature());
set.add(feature.getPlacedFeature());
}
accessor.bclib_setFeatures(allFeatures);
accessor.bclib_setFeatureSet(set);
}
/**