Add docs and util methods from #104 on top of previous PR

(I **completely** forgot I already implemented this for 1.16...)

Signed-off-by: Max <maxh2709@gmail.com>
This commit is contained in:
Max
2022-01-31 18:55:40 +01:00
parent 38a2e56461
commit fc31afa2b8
4 changed files with 44 additions and 11 deletions

View File

@@ -362,6 +362,11 @@ public final class BiomeHooks {
return settings.getCarvers(carving);
}
@Override
public List<Supplier<PlacedFeature>> getFeatures(GenerationStep.Decoration decoration) {
return settings.features().get(decoration.ordinal());
}
@Override
public List<List<Supplier<PlacedFeature>>> getFeatures() {
return settings.features();

View File

@@ -30,6 +30,8 @@ import java.util.function.Supplier;
public interface GenerationProperties {
List<Supplier<ConfiguredWorldCarver<?>>> getCarvers(GenerationStep.Carving carving);
List<Supplier<PlacedFeature>> getFeatures(GenerationStep.Decoration decoration);
List<List<Supplier<PlacedFeature>>> getFeatures();
interface Mutable extends GenerationProperties {

View File

@@ -27,6 +27,27 @@ import net.minecraft.resources.ResourceLocation;
import java.util.function.BiConsumer;
import java.util.function.Predicate;
/**
* This class provides a cross-platform API to modify Biome features and properties.
*
* <p> Changes to the biomes are hereby done in four distinct "phases", akin to Fabric API's
* {@link net.fabricmc.fabric.api.biome.v1.ModificationPhase} enum.
*
* <p> The order in which these phases get processed is as follows,
* with the corresponding Forge EventPriority shown in brackets:
*
* <ol>
* <li>{@linkplain #addProperties(Predicate, BiConsumer) Adding} new features to biomes. [HIGH]</li>
* <li>{@linkplain #removeProperties(Predicate, BiConsumer) Removing} existing features from biomes. [NORMAL]</li>
* <li>{@linkplain #replaceProperties(Predicate, BiConsumer) Replacing} existing features with new ones. [LOW]</li>
* <li>Generic {@linkplain #postProcessProperties(Predicate, BiConsumer) Post-Processing} of already modified biome features. [LOWEST]</li>
* </ol>
*
* Keep in mind that it isn't strictly <b>required</b> that you use these phases accordingly
* (i.e., you may also add features during Post-Processing, for example); they mostly serve to
* add a predictable order to biome modifications.
*/
@SuppressWarnings("JavadocReference")
public final class BiomeModifications {
public static void addProperties(BiConsumer<BiomeContext, BiomeProperties.Mutable> modifier) {
BiomeModifications.addProperties(Predicates.alwaysTrue(), modifier);