diff --git a/src/main/java/ru/bclib/api/PostInitAPI.java b/src/main/java/ru/bclib/api/PostInitAPI.java index 29adf17b..58f97714 100644 --- a/src/main/java/ru/bclib/api/PostInitAPI.java +++ b/src/main/java/ru/bclib/api/PostInitAPI.java @@ -7,6 +7,7 @@ import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.minecraft.client.renderer.RenderType; import net.minecraft.core.Registry; import net.minecraft.world.level.block.Block; +import ru.bclib.api.biomes.BiomeAPI; import ru.bclib.blocks.BaseBarrelBlock; import ru.bclib.blocks.BaseChestBlock; import ru.bclib.blocks.BaseFurnaceBlock; diff --git a/src/main/java/ru/bclib/world/biomes/BCLBiomeBuilder.java b/src/main/java/ru/bclib/api/biomes/BCLBiomeBuilder.java similarity index 98% rename from src/main/java/ru/bclib/world/biomes/BCLBiomeBuilder.java rename to src/main/java/ru/bclib/api/biomes/BCLBiomeBuilder.java index df7400d7..2fb4bdcf 100644 --- a/src/main/java/ru/bclib/world/biomes/BCLBiomeBuilder.java +++ b/src/main/java/ru/bclib/api/biomes/BCLBiomeBuilder.java @@ -1,4 +1,4 @@ -package ru.bclib.world.biomes; +package ru.bclib.api.biomes; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; @@ -9,6 +9,7 @@ import net.minecraft.world.level.biome.Biome.Precipitation; import net.minecraft.world.level.biome.BiomeSpecialEffects; import net.minecraft.world.level.biome.MobSpawnSettings; import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData; +import ru.bclib.world.biomes.BCLBiome; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/ru/bclib/api/BiomeAPI.java b/src/main/java/ru/bclib/api/biomes/BiomeAPI.java similarity index 97% rename from src/main/java/ru/bclib/api/BiomeAPI.java rename to src/main/java/ru/bclib/api/biomes/BiomeAPI.java index 3950f754..60005087 100644 --- a/src/main/java/ru/bclib/api/BiomeAPI.java +++ b/src/main/java/ru/bclib/api/biomes/BiomeAPI.java @@ -1,491 +1,491 @@ -package ru.bclib.api; - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.biome.v1.BiomeModifications; -import net.fabricmc.fabric.impl.biome.NetherBiomeData; -import net.fabricmc.fabric.impl.biome.TheEndBiomeData; -import net.minecraft.client.Minecraft; -import net.minecraft.core.Registry; -import net.minecraft.data.BuiltinRegistries; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.biome.BiomeSource; -import net.minecraft.world.level.biome.Biomes; -import net.minecraft.world.level.biome.Climate; -import net.minecraft.world.level.levelgen.GenerationStep.Decoration; -import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; -import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; -import net.minecraft.world.level.levelgen.placement.PlacedFeature; -import org.jetbrains.annotations.Nullable; -import ru.bclib.util.MHelper; -import ru.bclib.world.biomes.BCLBiome; -import ru.bclib.world.biomes.FabricBiomesData; -import ru.bclib.world.features.BCLFeature; -import ru.bclib.world.generator.BiomePicker; -import ru.bclib.world.structures.BCLStructureFeature; - -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Set; -import java.util.function.BiConsumer; - -public class BiomeAPI { - /** - * Empty biome used as default value if requested biome doesn't exist or linked. Shouldn't be registered anywhere to prevent bugs. - * Have {@code Biomes.THE_VOID} as the reference biome. - */ - public static final BCLBiome EMPTY_BIOME = new BCLBiome(Biomes.THE_VOID.location()); - - public static final BiomePicker NETHER_BIOME_PICKER = new BiomePicker(); - public static final BiomePicker END_LAND_BIOME_PICKER = new BiomePicker(); - public static final BiomePicker END_VOID_BIOME_PICKER = new BiomePicker(); - - private static final Map ID_MAP = Maps.newHashMap(); - private static final Map CLIENT = Maps.newHashMap(); - private static Registry biomeRegistry; - - private static final Map>> MODIFICATIONS = Maps.newHashMap(); - private static final Set MODIFIED_BIOMES = Sets.newHashSet(); - - public static final BCLBiome NETHER_WASTES_BIOME = registerNetherBiome(getFromRegistry(Biomes.NETHER_WASTES)); - public static final BCLBiome CRIMSON_FOREST_BIOME = registerNetherBiome(getFromRegistry(Biomes.CRIMSON_FOREST)); - public static final BCLBiome WARPED_FOREST_BIOME = registerNetherBiome(getFromRegistry(Biomes.WARPED_FOREST)); - public static final BCLBiome SOUL_SAND_VALLEY_BIOME = registerNetherBiome(getFromRegistry(Biomes.SOUL_SAND_VALLEY)); - public static final BCLBiome BASALT_DELTAS_BIOME = registerNetherBiome(getFromRegistry(Biomes.BASALT_DELTAS)); - - public static final BCLBiome THE_END = registerEndLandBiome(getFromRegistry(Biomes.THE_END)); - public static final BCLBiome END_MIDLANDS = registerSubBiome(THE_END, getFromRegistry(Biomes.END_MIDLANDS), 0.5F); - public static final BCLBiome END_HIGHLANDS = registerSubBiome(THE_END, getFromRegistry(Biomes.END_HIGHLANDS), 0.5F); - - public static final BCLBiome END_BARRENS = registerEndVoidBiome(getFromRegistry(new ResourceLocation("end_barrens"))); - public static final BCLBiome SMALL_END_ISLANDS = registerEndVoidBiome(getFromRegistry(new ResourceLocation("small_end_islands"))); - - /** - * Initialize registry for current server. - * - * @param server - {@link MinecraftServer} - */ - public static void initRegistry(MinecraftServer server) { - biomeRegistry = server.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); - CLIENT.clear(); - } - - /** - * Register {@link BCLBiome} instance and its {@link Biome} if necessary. - * @param biome {@link BCLBiome} - * @return {@link BCLBiome} - */ - public static BCLBiome registerBiome(BCLBiome biome) { - if (BuiltinRegistries.BIOME.get(biome.getID()) == null) { - Registry.register(BuiltinRegistries.BIOME, biome.getID(), biome.getBiome()); - } - ID_MAP.put(biome.getID(), biome); - return biome; - } - - public static BCLBiome registerSubBiome(BCLBiome parent, BCLBiome subBiome) { - registerBiome(subBiome); - parent.addSubBiome(subBiome); - return subBiome; - } - - public static BCLBiome registerSubBiome(BCLBiome parent, Biome biome, float genChance) { - BCLBiome subBiome = new BCLBiome(biome).setGenChance(genChance); - return registerSubBiome(parent, subBiome); - } - - /** - * Register {@link BCLBiome} instance and its {@link Biome} if necessary. - * After that biome will be added to BCLib Nether Biome Generator and into Fabric Biome API. - * @param biome {@link BCLBiome} - * @return {@link BCLBiome} - */ - public static BCLBiome registerNetherBiome(BCLBiome biome) { - registerBiome(biome); - NETHER_BIOME_PICKER.addBiome(biome); - Random random = new Random(biome.getID().hashCode()); - - //TODO: 1.18 Check parameters, depth was previously called altitude - //temperature, humidity, continentalness, erosion, depth, weirdness, offset - Climate.ParameterPoint parameters = Climate.parameters( - MHelper.randRange(-1.5F, 1.5F, random), - MHelper.randRange(-1.5F, 1.5F, random), - MHelper.randRange(-1.5F, 1.5F, random), //new in 1.18 - MHelper.randRange(-1.5F, 1.5F, random), //new in 1.18 - MHelper.randRange(-1.5F, 1.5F, random), - MHelper.randRange(-1.5F, 1.5F, random), - random.nextFloat() - ); - ResourceKey key = BuiltinRegistries.BIOME.getResourceKey(biome.getBiome()).get(); - NetherBiomeData.addNetherBiome(key, parameters); - return biome; - } - - /** - * Register {@link BCLBiome} instance and its {@link Biome} if necessary. - * After that biome will be added to BCLib Nether Biome Generator and into Fabric Biome API. - * @param biome {@link BCLBiome} - * @return {@link BCLBiome} - */ - public static BCLBiome registerNetherBiome(Biome biome) { - BCLBiome bclBiome = new BCLBiome(biome); - NETHER_BIOME_PICKER.addBiome(bclBiome); - registerBiome(bclBiome); - return bclBiome; - } - - /** - * Register {@link BCLBiome} instance and its {@link Biome} if necessary. - * After that biome will be added to BCLib End Biome Generator and into Fabric Biome API as a land biome (will generate only on islands). - * @param biome {@link BCLBiome} - * @return {@link BCLBiome} - */ - public static BCLBiome registerEndLandBiome(BCLBiome biome) { - registerBiome(biome); - END_LAND_BIOME_PICKER.addBiome(biome); - float weight = biome.getGenChance(); - ResourceKey key = BuiltinRegistries.BIOME.getResourceKey(biome.getBiome()).get(); - TheEndBiomeData.addEndBiomeReplacement(Biomes.END_HIGHLANDS, key, weight); - TheEndBiomeData.addEndBiomeReplacement(Biomes.END_MIDLANDS, key, weight); - return biome; - } - - /** - * Register {@link BCLBiome} wrapper for {@link Biome}. - * After that biome will be added to BCLib End Biome Generator and into Fabric Biome API as a land biome (will generate only on islands). - * @param biome {@link BCLBiome} - * @return {@link BCLBiome} - */ - public static BCLBiome registerEndLandBiome(Biome biome) { - BCLBiome bclBiome = new BCLBiome(biome); - END_LAND_BIOME_PICKER.addBiome(bclBiome); - registerBiome(bclBiome); - return bclBiome; - } - - /** - * Register {@link BCLBiome} wrapper for {@link Biome}. - * After that biome will be added to BCLib End Biome Generator and into Fabric Biome API as a land biome (will generate only on islands). - * @param biome {@link BCLBiome}; - * @param genChance float generation chance. - * @return {@link BCLBiome} - */ - public static BCLBiome registerEndLandBiome(Biome biome, float genChance) { - BCLBiome bclBiome = new BCLBiome(biome).setGenChance(genChance); - END_LAND_BIOME_PICKER.addBiome(bclBiome); - registerBiome(bclBiome); - return bclBiome; - } - - /** - * Register {@link BCLBiome} instance and its {@link Biome} if necessary. - * After that biome will be added to BCLib End Biome Generator and into Fabric Biome API as a void biome (will generate only in the End void - between islands). - * @param biome {@link BCLBiome} - * @return {@link BCLBiome} - */ - public static BCLBiome registerEndVoidBiome(BCLBiome biome) { - registerBiome(biome); - END_VOID_BIOME_PICKER.addBiome(biome); - float weight = biome.getGenChance(); - ResourceKey key = BuiltinRegistries.BIOME.getResourceKey(biome.getBiome()).get(); - TheEndBiomeData.addEndBiomeReplacement(Biomes.SMALL_END_ISLANDS, key, weight); - return biome; - } - - /** - * Register {@link BCLBiome} instance and its {@link Biome} if necessary. - * After that biome will be added to BCLib End Biome Generator and into Fabric Biome API as a void biome (will generate only in the End void - between islands). - * @param biome {@link BCLBiome} - * @return {@link BCLBiome} - */ - public static BCLBiome registerEndVoidBiome(Biome biome) { - BCLBiome bclBiome = new BCLBiome(biome); - END_VOID_BIOME_PICKER.addBiome(bclBiome); - registerBiome(bclBiome); - return bclBiome; - } - - /** - * Register {@link BCLBiome} instance and its {@link Biome} if necessary. - * After that biome will be added to BCLib End Biome Generator and into Fabric Biome API as a void biome (will generate only in the End void - between islands). - * @param biome {@link BCLBiome}. - * @param genChance float generation chance. - * @return {@link BCLBiome} - */ - public static BCLBiome registerEndVoidBiome(Biome biome, float genChance) { - ResourceKey key = BuiltinRegistries.BIOME.getResourceKey(biome).get(); - BCLBiome bclBiome = new BCLBiome(biome).setGenChance(genChance); - END_VOID_BIOME_PICKER.addBiome(bclBiome); - registerBiome(bclBiome); - return bclBiome; - } - - /** - * Get {@link BCLBiome} from {@link Biome} instance on server. Used to convert world biomes to BCLBiomes. - * @param biome - {@link Biome} from world. - * @return {@link BCLBiome} or {@code BiomeAPI.EMPTY_BIOME}. - */ - public static BCLBiome getFromBiome(Biome biome) { - if (biomeRegistry == null) { - return EMPTY_BIOME; - } - return ID_MAP.getOrDefault(biomeRegistry.getKey(biome), EMPTY_BIOME); - } - - /** - * Get {@link BCLBiome} from biome on client. Used in fog rendering. - * @param biome - {@link Biome} from client world. - * @return {@link BCLBiome} or {@code BiomeAPI.EMPTY_BIOME}. - */ - @Environment(EnvType.CLIENT) - public static BCLBiome getRenderBiome(Biome biome) { - BCLBiome endBiome = CLIENT.get(biome); - if (endBiome == null) { - Minecraft minecraft = Minecraft.getInstance(); - ResourceLocation id = minecraft.level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).getKey(biome); - endBiome = id == null ? EMPTY_BIOME : ID_MAP.getOrDefault(id, EMPTY_BIOME); - CLIENT.put(biome, endBiome); - } - return endBiome; - } - - /** - * Get biome {@link ResourceLocation} from given {@link Biome}. - * @param biome - {@link Biome} from server world. - * @return biome {@link ResourceLocation}. - */ - public static ResourceLocation getBiomeID(Biome biome) { - ResourceLocation id = biomeRegistry.getKey(biome); - return id == null ? EMPTY_BIOME.getID() : id; - } - - /** - * Get {@link BCLBiome} from given {@link ResourceLocation}. - * @param biomeID - biome {@link ResourceLocation}. - * @return {@link BCLBiome} or {@code BiomeAPI.EMPTY_BIOME}. - */ - public static BCLBiome getBiome(ResourceLocation biomeID) { - return ID_MAP.getOrDefault(biomeID, EMPTY_BIOME); - } - - /** - * Check if biome with {@link ResourceLocation} exists in API registry. - * @param biomeID - biome {@link ResourceLocation}. - * @return {@code true} if biome exists in API registry and {@code false} if not. - */ - public static boolean hasBiome(ResourceLocation biomeID) { - return ID_MAP.containsKey(biomeID); - } - - /** - * Load biomes from Fabric API. For internal usage only. - */ - public static void loadFabricAPIBiomes() { - FabricBiomesData.NETHER_BIOMES.forEach((key) -> { - if (!hasBiome(key.location())) { - registerNetherBiome(BuiltinRegistries.BIOME.get(key.location())); - } - }); - - FabricBiomesData.END_LAND_BIOMES.forEach((key, weight) -> { - if (!hasBiome(key.location())) { - registerEndLandBiome(BuiltinRegistries.BIOME.get(key.location()), weight); - } - }); - - FabricBiomesData.END_VOID_BIOMES.forEach((key, weight) -> { - if (!hasBiome(key.location())) { - registerEndVoidBiome(BuiltinRegistries.BIOME.get(key.location()), weight); - } - }); - } - - @Nullable - public static Biome getFromRegistry(ResourceLocation key) { - return BuiltinRegistries.BIOME.get(key); - } - - @Nullable - public static Biome getFromRegistry(ResourceKey key) { - return BuiltinRegistries.BIOME.get(key); - } - - public static boolean isDatapackBiome(ResourceLocation biomeID) { - return getFromRegistry(biomeID) == null; - } - - public static boolean isNetherBiome(ResourceLocation biomeID) { - return pickerHasBiome(NETHER_BIOME_PICKER, biomeID); - } - - public static boolean isEndBiome(ResourceLocation biomeID) { - return pickerHasBiome(END_LAND_BIOME_PICKER, biomeID) || pickerHasBiome(END_VOID_BIOME_PICKER, biomeID); - } - - private static boolean pickerHasBiome(BiomePicker picker, ResourceLocation key) { - return picker.getBiomes().stream().filter(biome -> biome.getID().equals(key)).findFirst().isPresent(); - } - - /** - * Registers new biome modification for specified dimension. Will work both for mod and datapack biomes. - * @param dimensionID {@link ResourceLocation} dimension ID, example: Level.OVERWORLD or "minecraft:overworld". - * @param modification {@link BiConsumer} with {@link ResourceKey} biome ID and {@link Biome} parameters. - */ - public static void registerBiomeModification(ResourceKey dimensionID, BiConsumer modification) { - List> modifications = MODIFICATIONS.get(dimensionID); - if (modifications == null) { - modifications = Lists.newArrayList(); - MODIFICATIONS.put(dimensionID, modifications); - } - modifications.add(modification); - } - - /** - * Registers new biome modification for the Overworld. Will work both for mod and datapack biomes. - * @param modification {@link BiConsumer} with {@link ResourceLocation} biome ID and {@link Biome} parameters. - */ - public static void registerOverworldBiomeModification(BiConsumer modification) { - registerBiomeModification(Level.OVERWORLD, modification); - } - - /** - * Registers new biome modification for the Nether. Will work both for mod and datapack biomes. - * @param modification {@link BiConsumer} with {@link ResourceLocation} biome ID and {@link Biome} parameters. - */ - public static void registerNetherBiomeModification(BiConsumer modification) { - registerBiomeModification(Level.NETHER, modification); - } - - /** - * Registers new biome modification for the End. Will work both for mod and datapack biomes. - * @param modification {@link BiConsumer} with {@link ResourceLocation} biome ID and {@link Biome} parameters. - */ - public static void registerEndBiomeModification(BiConsumer modification) { - registerBiomeModification(Level.END, modification); - } - - /** - * Will apply biome modifications to world, internal usage only. - * @param level - */ - public static void applyModifications(ServerLevel level) { - List> modifications = MODIFICATIONS.get(level.dimension()); - if (modifications == null) { - return; - } - BiomeSource source = level.getChunkSource().getGenerator().getBiomeSource(); - Set biomes = source.possibleBiomes(); - - biomes.forEach(biome -> { - ResourceLocation biomeID = getBiomeID(biome); - boolean modify = isDatapackBiome(biomeID); - if (biome != BuiltinRegistries.BIOME.get(biomeID)) { - modify = true; - } - else if (!modify && !MODIFIED_BIOMES.contains(biomeID)) { - MODIFIED_BIOMES.add(biomeID); - modify = true; - } - if (modify) { - modifications.forEach(consumer -> { - consumer.accept(biomeID, biome); - }); - } - }); - } - - /** - * Adds new features to existing biome. - * @param biome {@link Biome} to add features in. - * @param feature {@link ConfiguredFeature} to add. - * - */ - public static void addBiomeFeature(Biome biome, BCLFeature feature) { - addBiomeFeature(biome, feature.getPlacedFeature(), feature.getFeatureStep()); - } - - /** - * Adds new features to existing biome. - * @param biome {@link Biome} to add features in. - * @param feature {@link ConfiguredFeature} to add. - * @param step a {@link Decoration} step for the feature. - */ - public static void addBiomeFeature(Biome biome, PlacedFeature feature, Decoration step) { - BuiltinRegistries.PLACED_FEATURE - .getResourceKey(feature) - .ifPresent(key -> BiomeModifications.addFeature(ctx -> ctx.getBiomeKey().equals(BuiltinRegistries.BIOME.getKey(biome)), step, key)); - } - - /** - * Adds new features to existing biome. - * @param biome {@link Biome} to add features in. - * @param features array of {@link BCLFeature} to add. - */ - public static void addBiomeFeatures(Biome biome, BCLFeature... features) { - for (BCLFeature feature: features) { - addBiomeFeature(biome, feature.getPlacedFeature(), feature.getFeatureStep()); - } - } - - // TODO: 1.18 There are no more StructureFeatures in the Biomes, they are in a separate registry now - /** - * Adds new structure feature to existing biome. - * @param biome {@link Biome} to add structure feature in. - * @param structure {@link ConfiguredStructureFeature} to add. - */ - public static void addBiomeStructure(Biome biome, ConfiguredStructureFeature structure) { - BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE - .getResourceKey(structure) - .ifPresent(key -> BiomeModifications.addStructure(ctx -> ctx.getBiomeKey().location().equals(BuiltinRegistries.BIOME.getKey(biome)), key)); - } - /** - * Adds new structure feature to existing biome. - * @param biome {@link Biome} to add structure feature in. - * @param structure {@link BCLStructureFeature} to add. - */ - public static void addBiomeStructure(Biome biome, BCLStructureFeature structure) { - addBiomeStructure(biome, structure.getFeatureConfigured()); - } - - /** - * Adds new structure features to existing biome. - * @param biome {@link Biome} to add structure features in. - * @param structures array of {@link BCLStructureFeature} to add. - */ - public static void addBiomeStructures(Biome biome, BCLStructureFeature... structures) { - for (BCLStructureFeature structure: structures) { - addBiomeStructure(biome, structure.getFeatureConfigured()); - } - } - - /** - * Adds mob spawning to specified biome. - * @param biome {@link Biome} to add mob spawning. - * @param entityType {@link EntityType} mob type. - * @param weight spawn weight. - * @param minGroupCount minimum mobs in group. - * @param maxGroupCount maximum mobs in group. - */ - public static void addBiomeMobSpawn(Biome biome, EntityType entityType, int weight, int minGroupCount, int maxGroupCount) { - ResourceLocation biomeKey = BuiltinRegistries.BIOME.getKey(biome); - BiomeModifications.addSpawn( - ctx -> ctx.getBiomeKey().equals(biomeKey), - entityType.getCategory(), - entityType, - weight, - minGroupCount, - maxGroupCount - ); - } -} +package ru.bclib.api.biomes; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.biome.v1.BiomeModifications; +import net.fabricmc.fabric.impl.biome.NetherBiomeData; +import net.fabricmc.fabric.impl.biome.TheEndBiomeData; +import net.minecraft.client.Minecraft; +import net.minecraft.core.Registry; +import net.minecraft.data.BuiltinRegistries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.BiomeSource; +import net.minecraft.world.level.biome.Biomes; +import net.minecraft.world.level.biome.Climate; +import net.minecraft.world.level.levelgen.GenerationStep.Decoration; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; +import org.jetbrains.annotations.Nullable; +import ru.bclib.util.MHelper; +import ru.bclib.world.biomes.BCLBiome; +import ru.bclib.world.biomes.FabricBiomesData; +import ru.bclib.world.features.BCLFeature; +import ru.bclib.world.generator.BiomePicker; +import ru.bclib.world.structures.BCLStructureFeature; + +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.function.BiConsumer; + +public class BiomeAPI { + /** + * Empty biome used as default value if requested biome doesn't exist or linked. Shouldn't be registered anywhere to prevent bugs. + * Have {@code Biomes.THE_VOID} as the reference biome. + */ + public static final BCLBiome EMPTY_BIOME = new BCLBiome(Biomes.THE_VOID.location()); + + public static final BiomePicker NETHER_BIOME_PICKER = new BiomePicker(); + public static final BiomePicker END_LAND_BIOME_PICKER = new BiomePicker(); + public static final BiomePicker END_VOID_BIOME_PICKER = new BiomePicker(); + + private static final Map ID_MAP = Maps.newHashMap(); + private static final Map CLIENT = Maps.newHashMap(); + private static Registry biomeRegistry; + + private static final Map>> MODIFICATIONS = Maps.newHashMap(); + private static final Set MODIFIED_BIOMES = Sets.newHashSet(); + + public static final BCLBiome NETHER_WASTES_BIOME = registerNetherBiome(getFromRegistry(Biomes.NETHER_WASTES)); + public static final BCLBiome CRIMSON_FOREST_BIOME = registerNetherBiome(getFromRegistry(Biomes.CRIMSON_FOREST)); + public static final BCLBiome WARPED_FOREST_BIOME = registerNetherBiome(getFromRegistry(Biomes.WARPED_FOREST)); + public static final BCLBiome SOUL_SAND_VALLEY_BIOME = registerNetherBiome(getFromRegistry(Biomes.SOUL_SAND_VALLEY)); + public static final BCLBiome BASALT_DELTAS_BIOME = registerNetherBiome(getFromRegistry(Biomes.BASALT_DELTAS)); + + public static final BCLBiome THE_END = registerEndLandBiome(getFromRegistry(Biomes.THE_END)); + public static final BCLBiome END_MIDLANDS = registerSubBiome(THE_END, getFromRegistry(Biomes.END_MIDLANDS), 0.5F); + public static final BCLBiome END_HIGHLANDS = registerSubBiome(THE_END, getFromRegistry(Biomes.END_HIGHLANDS), 0.5F); + + public static final BCLBiome END_BARRENS = registerEndVoidBiome(getFromRegistry(new ResourceLocation("end_barrens"))); + public static final BCLBiome SMALL_END_ISLANDS = registerEndVoidBiome(getFromRegistry(new ResourceLocation("small_end_islands"))); + + /** + * Initialize registry for current server. + * + * @param server - {@link MinecraftServer} + */ + public static void initRegistry(MinecraftServer server) { + biomeRegistry = server.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); + CLIENT.clear(); + } + + /** + * Register {@link BCLBiome} instance and its {@link Biome} if necessary. + * @param biome {@link BCLBiome} + * @return {@link BCLBiome} + */ + public static BCLBiome registerBiome(BCLBiome biome) { + if (BuiltinRegistries.BIOME.get(biome.getID()) == null) { + Registry.register(BuiltinRegistries.BIOME, biome.getID(), biome.getBiome()); + } + ID_MAP.put(biome.getID(), biome); + return biome; + } + + public static BCLBiome registerSubBiome(BCLBiome parent, BCLBiome subBiome) { + registerBiome(subBiome); + parent.addSubBiome(subBiome); + return subBiome; + } + + public static BCLBiome registerSubBiome(BCLBiome parent, Biome biome, float genChance) { + BCLBiome subBiome = new BCLBiome(biome).setGenChance(genChance); + return registerSubBiome(parent, subBiome); + } + + /** + * Register {@link BCLBiome} instance and its {@link Biome} if necessary. + * After that biome will be added to BCLib Nether Biome Generator and into Fabric Biome API. + * @param biome {@link BCLBiome} + * @return {@link BCLBiome} + */ + public static BCLBiome registerNetherBiome(BCLBiome biome) { + registerBiome(biome); + NETHER_BIOME_PICKER.addBiome(biome); + Random random = new Random(biome.getID().hashCode()); + + //TODO: 1.18 Check parameters, depth was previously called altitude + //temperature, humidity, continentalness, erosion, depth, weirdness, offset + Climate.ParameterPoint parameters = Climate.parameters( + MHelper.randRange(-1.5F, 1.5F, random), + MHelper.randRange(-1.5F, 1.5F, random), + MHelper.randRange(-1.5F, 1.5F, random), //new in 1.18 + MHelper.randRange(-1.5F, 1.5F, random), //new in 1.18 + MHelper.randRange(-1.5F, 1.5F, random), + MHelper.randRange(-1.5F, 1.5F, random), + random.nextFloat() + ); + ResourceKey key = BuiltinRegistries.BIOME.getResourceKey(biome.getBiome()).get(); + NetherBiomeData.addNetherBiome(key, parameters); + return biome; + } + + /** + * Register {@link BCLBiome} instance and its {@link Biome} if necessary. + * After that biome will be added to BCLib Nether Biome Generator and into Fabric Biome API. + * @param biome {@link BCLBiome} + * @return {@link BCLBiome} + */ + public static BCLBiome registerNetherBiome(Biome biome) { + BCLBiome bclBiome = new BCLBiome(biome); + NETHER_BIOME_PICKER.addBiome(bclBiome); + registerBiome(bclBiome); + return bclBiome; + } + + /** + * Register {@link BCLBiome} instance and its {@link Biome} if necessary. + * After that biome will be added to BCLib End Biome Generator and into Fabric Biome API as a land biome (will generate only on islands). + * @param biome {@link BCLBiome} + * @return {@link BCLBiome} + */ + public static BCLBiome registerEndLandBiome(BCLBiome biome) { + registerBiome(biome); + END_LAND_BIOME_PICKER.addBiome(biome); + float weight = biome.getGenChance(); + ResourceKey key = BuiltinRegistries.BIOME.getResourceKey(biome.getBiome()).get(); + TheEndBiomeData.addEndBiomeReplacement(Biomes.END_HIGHLANDS, key, weight); + TheEndBiomeData.addEndBiomeReplacement(Biomes.END_MIDLANDS, key, weight); + return biome; + } + + /** + * Register {@link BCLBiome} wrapper for {@link Biome}. + * After that biome will be added to BCLib End Biome Generator and into Fabric Biome API as a land biome (will generate only on islands). + * @param biome {@link BCLBiome} + * @return {@link BCLBiome} + */ + public static BCLBiome registerEndLandBiome(Biome biome) { + BCLBiome bclBiome = new BCLBiome(biome); + END_LAND_BIOME_PICKER.addBiome(bclBiome); + registerBiome(bclBiome); + return bclBiome; + } + + /** + * Register {@link BCLBiome} wrapper for {@link Biome}. + * After that biome will be added to BCLib End Biome Generator and into Fabric Biome API as a land biome (will generate only on islands). + * @param biome {@link BCLBiome}; + * @param genChance float generation chance. + * @return {@link BCLBiome} + */ + public static BCLBiome registerEndLandBiome(Biome biome, float genChance) { + BCLBiome bclBiome = new BCLBiome(biome).setGenChance(genChance); + END_LAND_BIOME_PICKER.addBiome(bclBiome); + registerBiome(bclBiome); + return bclBiome; + } + + /** + * Register {@link BCLBiome} instance and its {@link Biome} if necessary. + * After that biome will be added to BCLib End Biome Generator and into Fabric Biome API as a void biome (will generate only in the End void - between islands). + * @param biome {@link BCLBiome} + * @return {@link BCLBiome} + */ + public static BCLBiome registerEndVoidBiome(BCLBiome biome) { + registerBiome(biome); + END_VOID_BIOME_PICKER.addBiome(biome); + float weight = biome.getGenChance(); + ResourceKey key = BuiltinRegistries.BIOME.getResourceKey(biome.getBiome()).get(); + TheEndBiomeData.addEndBiomeReplacement(Biomes.SMALL_END_ISLANDS, key, weight); + return biome; + } + + /** + * Register {@link BCLBiome} instance and its {@link Biome} if necessary. + * After that biome will be added to BCLib End Biome Generator and into Fabric Biome API as a void biome (will generate only in the End void - between islands). + * @param biome {@link BCLBiome} + * @return {@link BCLBiome} + */ + public static BCLBiome registerEndVoidBiome(Biome biome) { + BCLBiome bclBiome = new BCLBiome(biome); + END_VOID_BIOME_PICKER.addBiome(bclBiome); + registerBiome(bclBiome); + return bclBiome; + } + + /** + * Register {@link BCLBiome} instance and its {@link Biome} if necessary. + * After that biome will be added to BCLib End Biome Generator and into Fabric Biome API as a void biome (will generate only in the End void - between islands). + * @param biome {@link BCLBiome}. + * @param genChance float generation chance. + * @return {@link BCLBiome} + */ + public static BCLBiome registerEndVoidBiome(Biome biome, float genChance) { + ResourceKey key = BuiltinRegistries.BIOME.getResourceKey(biome).get(); + BCLBiome bclBiome = new BCLBiome(biome).setGenChance(genChance); + END_VOID_BIOME_PICKER.addBiome(bclBiome); + registerBiome(bclBiome); + return bclBiome; + } + + /** + * Get {@link BCLBiome} from {@link Biome} instance on server. Used to convert world biomes to BCLBiomes. + * @param biome - {@link Biome} from world. + * @return {@link BCLBiome} or {@code BiomeAPI.EMPTY_BIOME}. + */ + public static BCLBiome getFromBiome(Biome biome) { + if (biomeRegistry == null) { + return EMPTY_BIOME; + } + return ID_MAP.getOrDefault(biomeRegistry.getKey(biome), EMPTY_BIOME); + } + + /** + * Get {@link BCLBiome} from biome on client. Used in fog rendering. + * @param biome - {@link Biome} from client world. + * @return {@link BCLBiome} or {@code BiomeAPI.EMPTY_BIOME}. + */ + @Environment(EnvType.CLIENT) + public static BCLBiome getRenderBiome(Biome biome) { + BCLBiome endBiome = CLIENT.get(biome); + if (endBiome == null) { + Minecraft minecraft = Minecraft.getInstance(); + ResourceLocation id = minecraft.level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).getKey(biome); + endBiome = id == null ? EMPTY_BIOME : ID_MAP.getOrDefault(id, EMPTY_BIOME); + CLIENT.put(biome, endBiome); + } + return endBiome; + } + + /** + * Get biome {@link ResourceLocation} from given {@link Biome}. + * @param biome - {@link Biome} from server world. + * @return biome {@link ResourceLocation}. + */ + public static ResourceLocation getBiomeID(Biome biome) { + ResourceLocation id = biomeRegistry.getKey(biome); + return id == null ? EMPTY_BIOME.getID() : id; + } + + /** + * Get {@link BCLBiome} from given {@link ResourceLocation}. + * @param biomeID - biome {@link ResourceLocation}. + * @return {@link BCLBiome} or {@code BiomeAPI.EMPTY_BIOME}. + */ + public static BCLBiome getBiome(ResourceLocation biomeID) { + return ID_MAP.getOrDefault(biomeID, EMPTY_BIOME); + } + + /** + * Check if biome with {@link ResourceLocation} exists in API registry. + * @param biomeID - biome {@link ResourceLocation}. + * @return {@code true} if biome exists in API registry and {@code false} if not. + */ + public static boolean hasBiome(ResourceLocation biomeID) { + return ID_MAP.containsKey(biomeID); + } + + /** + * Load biomes from Fabric API. For internal usage only. + */ + public static void loadFabricAPIBiomes() { + FabricBiomesData.NETHER_BIOMES.forEach((key) -> { + if (!hasBiome(key.location())) { + registerNetherBiome(BuiltinRegistries.BIOME.get(key.location())); + } + }); + + FabricBiomesData.END_LAND_BIOMES.forEach((key, weight) -> { + if (!hasBiome(key.location())) { + registerEndLandBiome(BuiltinRegistries.BIOME.get(key.location()), weight); + } + }); + + FabricBiomesData.END_VOID_BIOMES.forEach((key, weight) -> { + if (!hasBiome(key.location())) { + registerEndVoidBiome(BuiltinRegistries.BIOME.get(key.location()), weight); + } + }); + } + + @Nullable + public static Biome getFromRegistry(ResourceLocation key) { + return BuiltinRegistries.BIOME.get(key); + } + + @Nullable + public static Biome getFromRegistry(ResourceKey key) { + return BuiltinRegistries.BIOME.get(key); + } + + public static boolean isDatapackBiome(ResourceLocation biomeID) { + return getFromRegistry(biomeID) == null; + } + + public static boolean isNetherBiome(ResourceLocation biomeID) { + return pickerHasBiome(NETHER_BIOME_PICKER, biomeID); + } + + public static boolean isEndBiome(ResourceLocation biomeID) { + return pickerHasBiome(END_LAND_BIOME_PICKER, biomeID) || pickerHasBiome(END_VOID_BIOME_PICKER, biomeID); + } + + private static boolean pickerHasBiome(BiomePicker picker, ResourceLocation key) { + return picker.getBiomes().stream().filter(biome -> biome.getID().equals(key)).findFirst().isPresent(); + } + + /** + * Registers new biome modification for specified dimension. Will work both for mod and datapack biomes. + * @param dimensionID {@link ResourceLocation} dimension ID, example: Level.OVERWORLD or "minecraft:overworld". + * @param modification {@link BiConsumer} with {@link ResourceKey} biome ID and {@link Biome} parameters. + */ + public static void registerBiomeModification(ResourceKey dimensionID, BiConsumer modification) { + List> modifications = MODIFICATIONS.get(dimensionID); + if (modifications == null) { + modifications = Lists.newArrayList(); + MODIFICATIONS.put(dimensionID, modifications); + } + modifications.add(modification); + } + + /** + * Registers new biome modification for the Overworld. Will work both for mod and datapack biomes. + * @param modification {@link BiConsumer} with {@link ResourceLocation} biome ID and {@link Biome} parameters. + */ + public static void registerOverworldBiomeModification(BiConsumer modification) { + registerBiomeModification(Level.OVERWORLD, modification); + } + + /** + * Registers new biome modification for the Nether. Will work both for mod and datapack biomes. + * @param modification {@link BiConsumer} with {@link ResourceLocation} biome ID and {@link Biome} parameters. + */ + public static void registerNetherBiomeModification(BiConsumer modification) { + registerBiomeModification(Level.NETHER, modification); + } + + /** + * Registers new biome modification for the End. Will work both for mod and datapack biomes. + * @param modification {@link BiConsumer} with {@link ResourceLocation} biome ID and {@link Biome} parameters. + */ + public static void registerEndBiomeModification(BiConsumer modification) { + registerBiomeModification(Level.END, modification); + } + + /** + * Will apply biome modifications to world, internal usage only. + * @param level + */ + public static void applyModifications(ServerLevel level) { + List> modifications = MODIFICATIONS.get(level.dimension()); + if (modifications == null) { + return; + } + BiomeSource source = level.getChunkSource().getGenerator().getBiomeSource(); + Set biomes = source.possibleBiomes(); + + biomes.forEach(biome -> { + ResourceLocation biomeID = getBiomeID(biome); + boolean modify = isDatapackBiome(biomeID); + if (biome != BuiltinRegistries.BIOME.get(biomeID)) { + modify = true; + } + else if (!modify && !MODIFIED_BIOMES.contains(biomeID)) { + MODIFIED_BIOMES.add(biomeID); + modify = true; + } + if (modify) { + modifications.forEach(consumer -> { + consumer.accept(biomeID, biome); + }); + } + }); + } + + /** + * Adds new features to existing biome. + * @param biome {@link Biome} to add features in. + * @param feature {@link ConfiguredFeature} to add. + * + */ + public static void addBiomeFeature(Biome biome, BCLFeature feature) { + addBiomeFeature(biome, feature.getPlacedFeature(), feature.getFeatureStep()); + } + + /** + * Adds new features to existing biome. + * @param biome {@link Biome} to add features in. + * @param feature {@link ConfiguredFeature} to add. + * @param step a {@link Decoration} step for the feature. + */ + public static void addBiomeFeature(Biome biome, PlacedFeature feature, Decoration step) { + BuiltinRegistries.PLACED_FEATURE + .getResourceKey(feature) + .ifPresent(key -> BiomeModifications.addFeature(ctx -> ctx.getBiomeKey().equals(BuiltinRegistries.BIOME.getKey(biome)), step, key)); + } + + /** + * Adds new features to existing biome. + * @param biome {@link Biome} to add features in. + * @param features array of {@link BCLFeature} to add. + */ + public static void addBiomeFeatures(Biome biome, BCLFeature... features) { + for (BCLFeature feature: features) { + addBiomeFeature(biome, feature.getPlacedFeature(), feature.getFeatureStep()); + } + } + + // TODO: 1.18 There are no more StructureFeatures in the Biomes, they are in a separate registry now + /** + * Adds new structure feature to existing biome. + * @param biome {@link Biome} to add structure feature in. + * @param structure {@link ConfiguredStructureFeature} to add. + */ + public static void addBiomeStructure(Biome biome, ConfiguredStructureFeature structure) { + BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE + .getResourceKey(structure) + .ifPresent(key -> BiomeModifications.addStructure(ctx -> ctx.getBiomeKey().location().equals(BuiltinRegistries.BIOME.getKey(biome)), key)); + } + /** + * Adds new structure feature to existing biome. + * @param biome {@link Biome} to add structure feature in. + * @param structure {@link BCLStructureFeature} to add. + */ + public static void addBiomeStructure(Biome biome, BCLStructureFeature structure) { + addBiomeStructure(biome, structure.getFeatureConfigured()); + } + + /** + * Adds new structure features to existing biome. + * @param biome {@link Biome} to add structure features in. + * @param structures array of {@link BCLStructureFeature} to add. + */ + public static void addBiomeStructures(Biome biome, BCLStructureFeature... structures) { + for (BCLStructureFeature structure: structures) { + addBiomeStructure(biome, structure.getFeatureConfigured()); + } + } + + /** + * Adds mob spawning to specified biome. + * @param biome {@link Biome} to add mob spawning. + * @param entityType {@link EntityType} mob type. + * @param weight spawn weight. + * @param minGroupCount minimum mobs in group. + * @param maxGroupCount maximum mobs in group. + */ + public static void addBiomeMobSpawn(Biome biome, EntityType entityType, int weight, int minGroupCount, int maxGroupCount) { + ResourceLocation biomeKey = BuiltinRegistries.BIOME.getKey(biome); + BiomeModifications.addSpawn( + ctx -> ctx.getBiomeKey().equals(biomeKey), + entityType.getCategory(), + entityType, + weight, + minGroupCount, + maxGroupCount + ); + } +} diff --git a/src/main/java/ru/bclib/client/render/CustomBackgroundRenderer.java b/src/main/java/ru/bclib/client/render/CustomBackgroundRenderer.java index 1828ad51..c26d4e5a 100644 --- a/src/main/java/ru/bclib/client/render/CustomBackgroundRenderer.java +++ b/src/main/java/ru/bclib/client/render/CustomBackgroundRenderer.java @@ -13,7 +13,7 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.material.FogType; -import ru.bclib.api.BiomeAPI; +import ru.bclib.api.biomes.BiomeAPI; import ru.bclib.util.BackgroundInfo; import ru.bclib.util.MHelper; import ru.bclib.world.biomes.BCLBiome; diff --git a/src/main/java/ru/bclib/mixin/common/BoneMealItemMixin.java b/src/main/java/ru/bclib/mixin/common/BoneMealItemMixin.java index 52357c1a..78ad381b 100644 --- a/src/main/java/ru/bclib/mixin/common/BoneMealItemMixin.java +++ b/src/main/java/ru/bclib/mixin/common/BoneMealItemMixin.java @@ -15,7 +15,7 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import ru.bclib.api.BiomeAPI; +import ru.bclib.api.biomes.BiomeAPI; import ru.bclib.api.BonemealAPI; import ru.bclib.util.BlocksHelper; import ru.bclib.util.MHelper; diff --git a/src/main/java/ru/bclib/mixin/common/MinecraftServerMixin.java b/src/main/java/ru/bclib/mixin/common/MinecraftServerMixin.java index 0b7cfc6a..5d455fb1 100644 --- a/src/main/java/ru/bclib/mixin/common/MinecraftServerMixin.java +++ b/src/main/java/ru/bclib/mixin/common/MinecraftServerMixin.java @@ -21,7 +21,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import ru.bclib.api.BiomeAPI; +import ru.bclib.api.biomes.BiomeAPI; import ru.bclib.api.dataexchange.DataExchangeAPI; import ru.bclib.recipes.BCLRecipeManager; diff --git a/src/main/java/ru/bclib/mixin/common/ServerLevelMixin.java b/src/main/java/ru/bclib/mixin/common/ServerLevelMixin.java index b9ae402c..60c82e64 100644 --- a/src/main/java/ru/bclib/mixin/common/ServerLevelMixin.java +++ b/src/main/java/ru/bclib/mixin/common/ServerLevelMixin.java @@ -16,7 +16,7 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import ru.bclib.api.BiomeAPI; +import ru.bclib.api.biomes.BiomeAPI; import ru.bclib.api.LifeCycleAPI; import java.util.List; diff --git a/src/main/java/ru/bclib/world/biomes/BCLBiomeDef.java b/src/main/java/ru/bclib/world/biomes/BCLBiomeDef.java index 2df240f3..a95b3e1b 100644 --- a/src/main/java/ru/bclib/world/biomes/BCLBiomeDef.java +++ b/src/main/java/ru/bclib/world/biomes/BCLBiomeDef.java @@ -27,7 +27,7 @@ import net.minecraft.world.level.levelgen.carver.CarverConfiguration; import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver; import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; import net.minecraft.world.level.levelgen.placement.PlacedFeature; -import ru.bclib.api.BiomeAPI; +import ru.bclib.api.biomes.BiomeAPI; import ru.bclib.config.IdConfig; import ru.bclib.config.PathConfig; import ru.bclib.util.ColorUtil; diff --git a/src/main/java/ru/bclib/world/features/NBTStructureFeature.java b/src/main/java/ru/bclib/world/features/NBTStructureFeature.java index 63a37fdd..f8f7dabe 100644 --- a/src/main/java/ru/bclib/world/features/NBTStructureFeature.java +++ b/src/main/java/ru/bclib/world/features/NBTStructureFeature.java @@ -19,7 +19,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConf import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; -import ru.bclib.api.BiomeAPI; +import ru.bclib.api.biomes.BiomeAPI; import ru.bclib.api.TagAPI; import ru.bclib.util.BlocksHelper; import ru.bclib.world.processors.DestructionStructureProcessor; diff --git a/src/main/java/ru/bclib/world/generator/BCLibEndBiomeSource.java b/src/main/java/ru/bclib/world/generator/BCLibEndBiomeSource.java index 89fc2c53..5debd380 100644 --- a/src/main/java/ru/bclib/world/generator/BCLibEndBiomeSource.java +++ b/src/main/java/ru/bclib/world/generator/BCLibEndBiomeSource.java @@ -15,7 +15,7 @@ import net.minecraft.world.level.levelgen.LegacyRandomSource; import net.minecraft.world.level.levelgen.WorldgenRandom; import net.minecraft.world.level.levelgen.synth.SimplexNoise; import ru.bclib.BCLib; -import ru.bclib.api.BiomeAPI; +import ru.bclib.api.biomes.BiomeAPI; import ru.bclib.config.ConfigKeeper.StringArrayEntry; import ru.bclib.config.Configs; import ru.bclib.noise.OpenSimplexNoise; diff --git a/src/main/java/ru/bclib/world/generator/BCLibNetherBiomeSource.java b/src/main/java/ru/bclib/world/generator/BCLibNetherBiomeSource.java index fefbdc91..8e2dff94 100644 --- a/src/main/java/ru/bclib/world/generator/BCLibNetherBiomeSource.java +++ b/src/main/java/ru/bclib/world/generator/BCLibNetherBiomeSource.java @@ -10,7 +10,7 @@ import net.minecraft.world.level.biome.Biome.BiomeCategory; import net.minecraft.world.level.biome.BiomeSource; import net.minecraft.world.level.biome.Climate; import ru.bclib.BCLib; -import ru.bclib.api.BiomeAPI; +import ru.bclib.api.biomes.BiomeAPI; import ru.bclib.config.ConfigKeeper.StringArrayEntry; import ru.bclib.config.Configs; import ru.bclib.world.biomes.BCLBiome;