From 0f923fa51f0e57293124f28b6e473168f6cc3ff9 Mon Sep 17 00:00:00 2001 From: Alex O'Neill <35673674+alcatrazEscapee@users.noreply.github.com> Date: Thu, 24 Sep 2020 02:39:25 -0400 Subject: [PATCH] Accessors for inspecting and removal of biome generation settings. Fixed carvers still being immutable. (#7339) --- .../world/BiomeGenerationSettingsBuilder.java | 28 ++++++++++++++++++- .../resources/META-INF/accesstransformer.cfg | 1 + 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/common/world/BiomeGenerationSettingsBuilder.java b/src/main/java/net/minecraftforge/common/world/BiomeGenerationSettingsBuilder.java index 2d3663b75..e6954dd3f 100644 --- a/src/main/java/net/minecraftforge/common/world/BiomeGenerationSettingsBuilder.java +++ b/src/main/java/net/minecraftforge/common/world/BiomeGenerationSettingsBuilder.java @@ -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>> getFeatures(GenerationStage.Decoration stage) { + func_242509_a(stage.ordinal()); + return field_242506_c.get(stage.ordinal()); + } + + public Optional>> getSurfaceBuilder() { + return field_242504_a; + } + + public List>> getCarvers(GenerationStage.Carving stage) { + return field_242505_b.computeIfAbsent(stage, key -> new ArrayList<>()); + } + + public List>> getStructures() { + return field_242507_d; + } } \ No newline at end of file diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 1c425d1fe..bedd2b914 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -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