Accessors for inspecting and removal of biome generation settings. Fixed carvers still being immutable. (#7339)

This commit is contained in:
Alex O'Neill 2020-09-24 02:39:25 -04:00 committed by GitHub
parent d1e3567c6b
commit 0f923fa51f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 1 deletions

View file

@ -20,17 +20,43 @@
package net.minecraftforge.common.world;
import net.minecraft.world.biome.BiomeGenerationSettings;
import net.minecraft.world.gen.GenerationStage;
import net.minecraft.world.gen.carver.ConfiguredCarver;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.StructureFeature;
import net.minecraft.world.gen.surfacebuilders.ConfiguredSurfaceBuilder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.function.Predicate;
import java.util.function.Supplier;
public class BiomeGenerationSettingsBuilder extends BiomeGenerationSettings.Builder
{
public BiomeGenerationSettingsBuilder(BiomeGenerationSettings orig)
{
field_242504_a = Optional.of(orig.func_242500_d());
orig.getCarvingStages().forEach(k -> field_242505_b.put(k, orig.func_242489_a(k)));
orig.getCarvingStages().forEach(k -> field_242505_b.put(k, new ArrayList<>(orig.func_242489_a(k))));
orig.func_242498_c().forEach(l -> field_242506_c.add(new ArrayList<>(l)));
field_242507_d.addAll(orig.func_242487_a());
}
public List<Supplier<ConfiguredFeature<?, ?>>> getFeatures(GenerationStage.Decoration stage) {
func_242509_a(stage.ordinal());
return field_242506_c.get(stage.ordinal());
}
public Optional<Supplier<ConfiguredSurfaceBuilder<?>>> getSurfaceBuilder() {
return field_242504_a;
}
public List<Supplier<ConfiguredCarver<?>>> getCarvers(GenerationStage.Carving stage) {
return field_242505_b.computeIfAbsent(stage, key -> new ArrayList<>());
}
public List<Supplier<StructureFeature<?, ?>>> getStructures() {
return field_242507_d;
}
}

View file

@ -309,6 +309,7 @@ protected net.minecraft.world.biome.BiomeGenerationSettings$Builder field_242504
protected net.minecraft.world.biome.BiomeGenerationSettings$Builder field_242505_b
protected net.minecraft.world.biome.BiomeGenerationSettings$Builder field_242506_c
protected net.minecraft.world.biome.BiomeGenerationSettings$Builder field_242507_d
protected net.minecraft.world.biome.BiomeGenerationSettings$Builder func_242509_a(I)V # populateStageEntries
protected net.minecraft.world.biome.MobSpawnInfo$Builder field_242567_a
protected net.minecraft.world.biome.MobSpawnInfo$Builder field_242568_b
protected net.minecraft.world.biome.MobSpawnInfo$Builder field_242569_c