/* * This file is part of architectury. * Copyright (C) 2020, 2021 architectury * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package me.shedaniel.architectury.registry; import com.google.common.base.Predicates; import me.shedaniel.architectury.annotations.ExpectPlatform; import me.shedaniel.architectury.hooks.biome.BiomeProperties; 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. * *

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. * *

The order in which these phases get processed is as follows, * with the corresponding Forge EventPriority shown in brackets: * *

    *
  1. {@link #addProperties(Predicate, BiConsumer) Adding} new features to biomes. [HIGH]
  2. *
  3. {@link #removeProperties(Predicate, BiConsumer) Removing} existing features from biomes. [NORMAL]
  4. *
  5. {@link #replaceProperties(Predicate, BiConsumer) Replacing} existing features with new ones. [LOW]
  6. *
  7. Generic {@link #postProcessProperties(Predicate, BiConsumer) Post-Processing} of already modified biome features. [LOWEST]
  8. *
* * Keep in mind that it isn't strictly required 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. */ public final class BiomeModifications { public static void addProperties(BiConsumer modifier) { BiomeModifications.addProperties(Predicates.alwaysTrue(), modifier); } @ExpectPlatform public static void addProperties(Predicate predicate, BiConsumer modifier) { throw new AssertionError(); } public static void postProcessProperties(BiConsumer modifier) { BiomeModifications.postProcessProperties(Predicates.alwaysTrue(), modifier); } @ExpectPlatform public static void postProcessProperties(Predicate predicate, BiConsumer modifier) { throw new AssertionError(); } public static void removeProperties(BiConsumer modifier) { BiomeModifications.removeProperties(Predicates.alwaysTrue(), modifier); } @ExpectPlatform public static void removeProperties(Predicate predicate, BiConsumer modifier) { throw new AssertionError(); } public static void replaceProperties(BiConsumer modifier) { BiomeModifications.replaceProperties(Predicates.alwaysTrue(), modifier); } @ExpectPlatform public static void replaceProperties(Predicate predicate, BiConsumer modifier) { throw new AssertionError(); } public interface BiomeContext { ResourceLocation getKey(); BiomeProperties getProperties(); } }