[Changes] BCLBiomeSource
relies more on BCLRegistry
This commit is contained in:
parent
a592c05b4d
commit
561fc130a3
12 changed files with 723 additions and 454 deletions
|
@ -2,62 +2,68 @@ package org.betterx.bclib.api.v2.generator;
|
||||||
|
|
||||||
import org.betterx.bclib.BCLib;
|
import org.betterx.bclib.BCLib;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.InternalBiomeAPI;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeRegistry;
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
|
||||||
|
import org.betterx.bclib.config.Configs;
|
||||||
import org.betterx.worlds.together.biomesource.BiomeSourceFromRegistry;
|
import org.betterx.worlds.together.biomesource.BiomeSourceFromRegistry;
|
||||||
import org.betterx.worlds.together.biomesource.BiomeSourceHelper;
|
import org.betterx.worlds.together.biomesource.BiomeSourceHelper;
|
||||||
import org.betterx.worlds.together.biomesource.MergeableBiomeSource;
|
import org.betterx.worlds.together.biomesource.MergeableBiomeSource;
|
||||||
|
import org.betterx.worlds.together.biomesource.ReloadableBiomeSource;
|
||||||
import org.betterx.worlds.together.world.BiomeSourceWithNoiseRelatedSettings;
|
import org.betterx.worlds.together.world.BiomeSourceWithNoiseRelatedSettings;
|
||||||
import org.betterx.worlds.together.world.BiomeSourceWithSeed;
|
import org.betterx.worlds.together.world.BiomeSourceWithSeed;
|
||||||
|
import org.betterx.worlds.together.world.event.WorldBootstrap;
|
||||||
|
|
||||||
import net.minecraft.core.Holder;
|
import net.minecraft.core.Holder;
|
||||||
import net.minecraft.core.HolderGetter;
|
import net.minecraft.core.HolderGetter;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.core.RegistryAccess;
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.biome.BiomeSource;
|
import net.minecraft.world.level.biome.BiomeSource;
|
||||||
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
|
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public abstract class BCLBiomeSource extends BiomeSource implements BiomeSourceWithSeed, MergeableBiomeSource<BCLBiomeSource>, BiomeSourceWithNoiseRelatedSettings, BiomeSourceFromRegistry<BCLBiomeSource> {
|
public abstract class BCLBiomeSource extends BiomeSource implements BiomeSourceWithSeed, MergeableBiomeSource<BCLBiomeSource>, BiomeSourceWithNoiseRelatedSettings, ReloadableBiomeSource, BiomeSourceFromRegistry<BCLBiomeSource> {
|
||||||
protected final HolderGetter<Biome> biomeRegistry;
|
@FunctionalInterface
|
||||||
protected final HolderGetter<BCLBiome> bclBiomeRegistry;
|
public interface PickerAdder {
|
||||||
private int registryModificationCounter;
|
boolean add(BCLBiome bclBiome, BiomeAPI.BiomeType type, BiomePicker picker);
|
||||||
protected long currentSeed;
|
|
||||||
protected int maxHeight;
|
|
||||||
|
|
||||||
private static List<Holder<Biome>> preInit(
|
|
||||||
HolderGetter<Biome> biomeRegistry,
|
|
||||||
List<Holder<Biome>> biomes
|
|
||||||
) {
|
|
||||||
biomes = biomes.stream().sorted(Comparator.comparing(holder -> holder.unwrapKey()
|
|
||||||
.get()
|
|
||||||
.location()
|
|
||||||
.toString()))
|
|
||||||
.toList();
|
|
||||||
return biomes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BCLBiomeSource(
|
@FunctionalInterface
|
||||||
HolderGetter<Biome> biomeRegistry,
|
public interface CustomTypeFinder {
|
||||||
HolderGetter<BCLBiome> bclBiomeRegistry,
|
BiomeAPI.BiomeType find(ResourceKey<Biome> biomeKey, BiomeAPI.BiomeType defaultType);
|
||||||
List<Holder<Biome>> list,
|
}
|
||||||
long seed
|
|
||||||
) {
|
protected long currentSeed;
|
||||||
super(preInit(biomeRegistry, list));
|
protected int maxHeight;
|
||||||
this.registryModificationCounter = InternalBiomeAPI.getBiomeRegistryModificationCount(biomeRegistry);
|
private boolean didCreatePickers;
|
||||||
this.biomeRegistry = biomeRegistry;
|
Set<Holder<Biome>> dynamicPossibleBiomes;
|
||||||
this.bclBiomeRegistry = bclBiomeRegistry;
|
|
||||||
|
protected BCLBiomeSource(long seed) {
|
||||||
|
super(List.of());
|
||||||
|
this.dynamicPossibleBiomes = Set.of();
|
||||||
this.currentSeed = seed;
|
this.currentSeed = seed;
|
||||||
|
this.didCreatePickers = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Holder<Biome>> possibleBiomes() {
|
||||||
|
return dynamicPossibleBiomes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean didBiomeRegistryChange() {
|
public boolean didBiomeRegistryChange() {
|
||||||
return this.registryModificationCounter != InternalBiomeAPI.getBiomeRegistryModificationCount(biomeRegistry);
|
return false;
|
||||||
|
//return this.registryModificationCounter != InternalBiomeAPI.getBiomeRegistryModificationCount(biomeRegistry);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean wasBound() {
|
||||||
|
return didCreatePickers;
|
||||||
}
|
}
|
||||||
|
|
||||||
final public void setSeed(long seed) {
|
final public void setSeed(long seed) {
|
||||||
|
@ -102,52 +108,168 @@ public abstract class BCLBiomeSource extends BiomeSource implements BiomeSourceW
|
||||||
return BiomeSourceHelper.getNamespaces(possibleBiomes());
|
return BiomeSourceHelper.getNamespaces(possibleBiomes());
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ValidBiomePredicate {
|
// public interface ValidBiomePredicate {
|
||||||
boolean isValid(Holder<Biome> biome, ResourceLocation location);
|
// boolean isValid(Holder<Biome> biome, ResourceLocation location);
|
||||||
|
// }
|
||||||
|
|
||||||
|
protected boolean addToPicker(BCLBiome bclBiome, BiomeAPI.BiomeType type, BiomePicker picker) {
|
||||||
|
picker.addBiome(bclBiome);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static List<Holder<Biome>> getBiomes(
|
protected BiomeAPI.BiomeType typeForUnknownBiome(ResourceKey<Biome> biomeKey, BiomeAPI.BiomeType defaultType) {
|
||||||
HolderGetter<Biome> getter,
|
return defaultType;
|
||||||
HolderGetter<BCLBiome> bclBiomeRegistry,
|
}
|
||||||
List<String> exclude,
|
|
||||||
List<String> include,
|
|
||||||
BCLibNetherBiomeSource.ValidBiomePredicate test
|
protected static Set<Holder<Biome>> populateBiomePickers(
|
||||||
|
Map<BiomeAPI.BiomeType, BiomePicker> acceptedBiomeTypes,
|
||||||
|
BiomeAPI.BiomeType exclusionListType,
|
||||||
|
PickerAdder pickerAdder,
|
||||||
|
CustomTypeFinder typeFinder
|
||||||
) {
|
) {
|
||||||
Optional<Field> res = Arrays.stream(getter.getClass().getFields())
|
final RegistryAccess access = WorldBootstrap.getLastRegistryAccess();
|
||||||
.filter(f -> Registry.class.isAssignableFrom(f.getType()))
|
if (access == null) {
|
||||||
.findFirst();
|
BCLib.LOGGER.info("Unable to build Biome List yet");
|
||||||
if (res.isPresent()) {
|
return null;
|
||||||
try {
|
|
||||||
Registry<Biome> biomeRegistry = (Registry<Biome>) res.get().get(getter);
|
|
||||||
|
|
||||||
return biomeRegistry.stream()
|
|
||||||
.filter(biome -> biomeRegistry.getResourceKey(biome).isPresent())
|
|
||||||
.map(biome -> (Holder<Biome>) biomeRegistry.getHolderOrThrow(
|
|
||||||
biomeRegistry.getResourceKey(biome).get())
|
|
||||||
)
|
|
||||||
.filter(biome -> {
|
|
||||||
ResourceLocation location = biome.unwrapKey().orElseThrow().location();
|
|
||||||
final String strLocation = location.toString();
|
|
||||||
if (exclude.contains(strLocation)) return false;
|
|
||||||
if (include.contains(strLocation)) return true;
|
|
||||||
|
|
||||||
return test.isValid(biome, location);
|
|
||||||
})
|
|
||||||
.toList();
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
BCLib.LOGGER.error("Unable to load field", e);
|
|
||||||
return List.of();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
BCLib.LOGGER.error("Unable to access Biome Registry..");
|
|
||||||
return List.of();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Set<Holder<Biome>> allBiomes = new HashSet<>();
|
||||||
|
final Map<BiomeAPI.BiomeType, List<String>> includeMap = Configs.BIOMES_CONFIG.getBiomeIncludeMap();
|
||||||
|
final List<String> excludeList = Configs.BIOMES_CONFIG.getExcludeMatching(exclusionListType);
|
||||||
|
final Registry<Biome> biomes = access.registryOrThrow(Registries.BIOME);
|
||||||
|
final Registry<BCLBiome> bclBiomes = access.registryOrThrow(BCLBiomeRegistry.BCL_BIOMES_REGISTRY);
|
||||||
|
|
||||||
|
final List<Map.Entry<ResourceKey<Biome>, Biome>> sortedList = biomes
|
||||||
|
.entrySet()
|
||||||
|
.stream()
|
||||||
|
.sorted(Comparator.comparing(a -> a.getKey().location().toString()))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
for (Map.Entry<ResourceKey<Biome>, Biome> biomeEntry : sortedList) {
|
||||||
|
if (excludeList.contains(biomeEntry.getKey().location())) continue;
|
||||||
|
|
||||||
|
BiomeAPI.BiomeType type = BiomeAPI.BiomeType.NONE;
|
||||||
|
boolean foundBCLBiome = false;
|
||||||
|
if (BCLBiomeRegistry.hasBiome(biomeEntry.getKey(), bclBiomes)) {
|
||||||
|
foundBCLBiome = true;
|
||||||
|
type = BCLBiomeRegistry.getBiome(biomeEntry.getKey(), bclBiomes).getIntendedType();
|
||||||
|
} else {
|
||||||
|
type = typeFinder.find(biomeEntry.getKey(), type);
|
||||||
|
}
|
||||||
|
|
||||||
|
type = getBiomeType(includeMap, biomeEntry.getKey(), type);
|
||||||
|
|
||||||
|
for (Map.Entry<BiomeAPI.BiomeType, BiomePicker> pickerEntry : acceptedBiomeTypes.entrySet()) {
|
||||||
|
if (type.is(pickerEntry.getKey())) {
|
||||||
|
BCLBiome bclBiome;
|
||||||
|
if (foundBCLBiome) {
|
||||||
|
bclBiome = BCLBiomeRegistry.getBiome(biomeEntry.getKey(), bclBiomes);
|
||||||
|
} else {
|
||||||
|
//create and register a biome wrapper
|
||||||
|
bclBiome = new BCLBiome(biomeEntry.getKey().location(), type);
|
||||||
|
BCLBiomeRegistry.register(bclBiome);
|
||||||
|
foundBCLBiome = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean didAdd = false;
|
||||||
|
if (!bclBiome.hasParentBiome()) {
|
||||||
|
didAdd = pickerAdder.add(bclBiome, pickerEntry.getKey(), pickerEntry.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (didAdd) {
|
||||||
|
allBiomes.add(biomes.getHolderOrThrow(biomeEntry.getKey()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return allBiomes;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract BiomeAPI.BiomeType defaultBiomeType();
|
||||||
|
protected abstract Map<BiomeAPI.BiomeType, BiomePicker> createFreshPickerMap();
|
||||||
|
|
||||||
|
public abstract String toShortString();
|
||||||
|
|
||||||
|
protected void onFinishBiomeRebuild(Map<BiomeAPI.BiomeType, BiomePicker> pickerMap) {
|
||||||
|
for (var picker : pickerMap.values()) {
|
||||||
|
picker.rebuild();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected final void rebuildBiomes(boolean force) {
|
||||||
|
if (!force && didCreatePickers) return;
|
||||||
|
|
||||||
|
if (Configs.MAIN_CONFIG.verboseLogging()) {
|
||||||
|
BCLib.LOGGER.info("Updating Pickers for " + this.toShortString());
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<BiomeAPI.BiomeType, BiomePicker> pickerMap = createFreshPickerMap();
|
||||||
|
this.dynamicPossibleBiomes = populateBiomePickers(
|
||||||
|
pickerMap,
|
||||||
|
defaultBiomeType(),
|
||||||
|
this::addToPicker,
|
||||||
|
this::typeForUnknownBiome
|
||||||
|
);
|
||||||
|
if (this.dynamicPossibleBiomes == null) {
|
||||||
|
this.dynamicPossibleBiomes = Set.of();
|
||||||
|
} else {
|
||||||
|
this.didCreatePickers = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
onFinishBiomeRebuild(pickerMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BCLBiomeSource mergeWithBiomeSource(BiomeSource inputBiomeSource) {
|
public BCLBiomeSource mergeWithBiomeSource(BiomeSource inputBiomeSource) {
|
||||||
final Set<Holder<Biome>> datapackBiomes = inputBiomeSource.possibleBiomes();
|
final RegistryAccess access = WorldBootstrap.getLastRegistryAccess();
|
||||||
return this.createCopyForDatapack(datapackBiomes);
|
if (access == null) {
|
||||||
|
BCLib.LOGGER.error("Unable to merge Biomesources!");
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Map<BiomeAPI.BiomeType, List<String>> includeMap = Configs.BIOMES_CONFIG.getBiomeIncludeMap();
|
||||||
|
final List<String> excludeList = Configs.BIOMES_CONFIG.getExcludeMatching(defaultBiomeType());
|
||||||
|
final Registry<BCLBiome> bclBiomes = access.registryOrThrow(BCLBiomeRegistry.BCL_BIOMES_REGISTRY);
|
||||||
|
|
||||||
|
for (Holder<Biome> possibleBiome : inputBiomeSource.possibleBiomes()) {
|
||||||
|
ResourceKey<Biome> key = possibleBiome.unwrapKey().orElse(null);
|
||||||
|
if (key != null) {
|
||||||
|
//skip over all biomes that were excluded in the config
|
||||||
|
if (excludeList.contains(key.location())) continue;
|
||||||
|
|
||||||
|
//this is a biome that has no type entry => create a new one for the default type of this registry
|
||||||
|
if (!BCLBiomeRegistry.hasBiome(key, bclBiomes)) {
|
||||||
|
BiomeAPI.BiomeType type = typeForUnknownBiome(key, defaultBiomeType());
|
||||||
|
|
||||||
|
//check if there was an override defined in the configs
|
||||||
|
type = getBiomeType(includeMap, key, type);
|
||||||
|
|
||||||
|
//create and register a biome wrapper
|
||||||
|
BCLBiome bclBiome = new BCLBiome(key.location(), type);
|
||||||
|
BCLBiomeRegistry.register(bclBiome);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.reloadBiomes();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static BiomeAPI.BiomeType getBiomeType(
|
||||||
|
Map<BiomeAPI.BiomeType, List<String>> includeMap,
|
||||||
|
ResourceKey<Biome> biomeKey,
|
||||||
|
BiomeAPI.BiomeType defaultType
|
||||||
|
) {
|
||||||
|
for (Map.Entry<BiomeAPI.BiomeType, List<String>> includeList : includeMap.entrySet()) {
|
||||||
|
if (includeList.getValue().contains(biomeKey.location().toString())) {
|
||||||
|
return includeList.getKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaultType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLoadGeneratorSettings(NoiseGeneratorSettings generator) {
|
public void onLoadGeneratorSettings(NoiseGeneratorSettings generator) {
|
||||||
|
@ -156,6 +278,17 @@ public abstract class BCLBiomeSource extends BiomeSource implements BiomeSourceW
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HolderGetter<Biome> getBiomeRegistry() {
|
public HolderGetter<Biome> getBiomeRegistry() {
|
||||||
return biomeRegistry;
|
//return biomeRegistry;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void reloadBiomes(boolean force) {
|
||||||
|
rebuildBiomes(force);
|
||||||
|
this.initMap(currentSeed);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reloadBiomes() {
|
||||||
|
reloadBiomes(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,8 @@ import org.betterx.bclib.api.v2.generator.config.BCLEndBiomeSourceConfig;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeRegistry;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeRegistry;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.InternalBiomeAPI;
|
|
||||||
import org.betterx.bclib.config.Configs;
|
|
||||||
import org.betterx.bclib.interfaces.BiomeMap;
|
import org.betterx.bclib.interfaces.BiomeMap;
|
||||||
import org.betterx.worlds.together.biomesource.BiomeSourceWithConfig;
|
import org.betterx.worlds.together.biomesource.BiomeSourceWithConfig;
|
||||||
import org.betterx.worlds.together.biomesource.ReloadableBiomeSource;
|
|
||||||
import org.betterx.worlds.together.world.event.WorldBootstrap;
|
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
|
@ -28,13 +24,12 @@ import net.minecraft.world.level.biome.Climate;
|
||||||
import net.minecraft.world.level.levelgen.DensityFunction;
|
import net.minecraft.world.level.levelgen.DensityFunction;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class BCLibEndBiomeSource extends BCLBiomeSource implements BiomeSourceWithConfig<BCLibEndBiomeSource, BCLEndBiomeSourceConfig>, ReloadableBiomeSource {
|
public class BCLibEndBiomeSource extends BCLBiomeSource implements BiomeSourceWithConfig<BCLibEndBiomeSource, BCLEndBiomeSourceConfig> {
|
||||||
public static Codec<BCLibEndBiomeSource> CODEC
|
public static Codec<BCLibEndBiomeSource> CODEC
|
||||||
= RecordCodecBuilder.create((instance) -> instance
|
= RecordCodecBuilder.create((instance) -> instance
|
||||||
.group(
|
.group(
|
||||||
|
@ -94,7 +89,7 @@ public class BCLibEndBiomeSource extends BCLBiomeSource implements BiomeSourceWi
|
||||||
BCLEndBiomeSourceConfig config,
|
BCLEndBiomeSourceConfig config,
|
||||||
boolean initMaps
|
boolean initMaps
|
||||||
) {
|
) {
|
||||||
this(biomeRegistry, bclBiomeRegistry, getBiomes(biomeRegistry, bclBiomeRegistry), seed, config, initMaps);
|
this(biomeRegistry, bclBiomeRegistry, null, seed, config, initMaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BCLibEndBiomeSource(
|
private BCLibEndBiomeSource(
|
||||||
|
@ -105,9 +100,9 @@ public class BCLibEndBiomeSource extends BCLBiomeSource implements BiomeSourceWi
|
||||||
BCLEndBiomeSourceConfig config,
|
BCLEndBiomeSourceConfig config,
|
||||||
boolean initMaps
|
boolean initMaps
|
||||||
) {
|
) {
|
||||||
super(biomeRegistry, bclBiomeRegistry, list, seed);
|
super(seed);
|
||||||
this.config = config;
|
this.config = config;
|
||||||
rebuildBiomePickers();
|
rebuildBiomes(false);
|
||||||
|
|
||||||
this.pos = new Point();
|
this.pos = new Point();
|
||||||
|
|
||||||
|
@ -116,122 +111,68 @@ public class BCLibEndBiomeSource extends BCLBiomeSource implements BiomeSourceWi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BiomeAPI.BiomeType defaultBiomeType() {
|
||||||
|
return BiomeAPI.BiomeType.END;
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@Override
|
||||||
private void rebuildBiomePickers() {
|
protected Map<BiomeAPI.BiomeType, BiomePicker> createFreshPickerMap() {
|
||||||
if (WorldBootstrap.getLastRegistryAccess() == null) {
|
|
||||||
this.endLandBiomePicker = null;
|
|
||||||
this.endVoidBiomePicker = null;
|
|
||||||
this.endCenterBiomePicker = null;
|
|
||||||
this.endBarrensBiomePicker = null;
|
|
||||||
this.deciders = List.of();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
HolderLookup.RegistryLookup<Biome> biomeRegistry = WorldBootstrap.getLastRegistryAccess()
|
|
||||||
.lookupOrThrow(Registries.BIOME);
|
|
||||||
Registry<BCLBiome> bclBiomeRegistry = WorldBootstrap.getLastRegistryAccess()
|
|
||||||
.registryOrThrow(BCLBiomeRegistry.BCL_BIOMES_REGISTRY);
|
|
||||||
|
|
||||||
|
|
||||||
var includeMap = Configs.BIOMES_CONFIG.getBiomeIncludeMap();
|
|
||||||
var excludeList = Configs.BIOMES_CONFIG.getExcludeMatching(BiomeAPI.BiomeType.END);
|
|
||||||
|
|
||||||
this.deciders = BiomeDecider.DECIDERS.stream()
|
this.deciders = BiomeDecider.DECIDERS.stream()
|
||||||
.filter(d -> d.canProvideFor(this))
|
.filter(d -> d.canProvideFor(this))
|
||||||
.map(d -> d.createInstance(this))
|
.map(d -> d.createInstance(this))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
this.endLandBiomePicker = new BiomePicker(biomeRegistry);
|
this.endLandBiomePicker = new BiomePicker();
|
||||||
this.endVoidBiomePicker = new BiomePicker(biomeRegistry);
|
this.endVoidBiomePicker = new BiomePicker();
|
||||||
this.endCenterBiomePicker = new BiomePicker(biomeRegistry);
|
this.endCenterBiomePicker = new BiomePicker();
|
||||||
this.endBarrensBiomePicker = new BiomePicker(biomeRegistry);
|
this.endBarrensBiomePicker = new BiomePicker();
|
||||||
Map<BiomeAPI.BiomeType, BiomePicker> pickerMap = new HashMap<>();
|
|
||||||
pickerMap.put(BiomeAPI.BiomeType.END_LAND, endLandBiomePicker);
|
|
||||||
pickerMap.put(BiomeAPI.BiomeType.END_VOID, endVoidBiomePicker);
|
|
||||||
pickerMap.put(BiomeAPI.BiomeType.END_CENTER, endCenterBiomePicker);
|
|
||||||
pickerMap.put(BiomeAPI.BiomeType.END_BARRENS, endBarrensBiomePicker);
|
|
||||||
|
|
||||||
|
return Map.of(
|
||||||
|
BiomeAPI.BiomeType.END_LAND, endLandBiomePicker,
|
||||||
|
BiomeAPI.BiomeType.END_VOID, endVoidBiomePicker,
|
||||||
|
BiomeAPI.BiomeType.END_CENTER, endCenterBiomePicker,
|
||||||
|
BiomeAPI.BiomeType.END_BARRENS, endBarrensBiomePicker
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
this.possibleBiomes().forEach(biome -> {
|
protected boolean addToPicker(BCLBiome bclBiome, BiomeAPI.BiomeType type, BiomePicker picker) {
|
||||||
ResourceKey<Biome> key = biome.unwrapKey().orElseThrow();
|
if (!config.withVoidBiomes) {
|
||||||
ResourceLocation biomeID = key.location();
|
if (bclBiome.getID().equals(Biomes.SMALL_END_ISLANDS.location())) {
|
||||||
String biomeStr = biomeID.toString();
|
return false;
|
||||||
//exclude everything that was listed
|
|
||||||
if (excludeList != null && excludeList.contains(biomeStr)) return;
|
|
||||||
if (!biome.isBound()) {
|
|
||||||
BCLib.LOGGER.warning("Biome " + biomeStr + " is requested but not yet bound.");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
final BCLBiome bclBiome;
|
}
|
||||||
if (!bclBiomeRegistry.containsKey(biomeID)) {
|
|
||||||
bclBiome = new BCLBiome(biomeID, BiomeAPI.BiomeType.END_LAND);
|
for (BiomeDecider decider : deciders) {
|
||||||
InternalBiomeAPI.registerBCLBiomeData(bclBiome);
|
if (decider.addToPicker(bclBiome)) {
|
||||||
} else {
|
return true;
|
||||||
bclBiome = bclBiomeRegistry.get(biomeID);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.addToPicker(bclBiome, type, picker);
|
||||||
|
}
|
||||||
|
|
||||||
if (!BCLBiomeRegistry.isEmptyBiome(bclBiome)) {
|
@Override
|
||||||
if (bclBiome.getParentBiome() == null) {
|
protected BiomeAPI.BiomeType typeForUnknownBiome(ResourceKey<Biome> biomeKey, BiomeAPI.BiomeType defaultType) {
|
||||||
//ignore small islands when void biomes are disabled
|
if (TheEndBiomesHelper.canGenerateAsMainIslandBiome(biomeKey)) {
|
||||||
if (!config.withVoidBiomes) {
|
return BiomeAPI.BiomeType.END_CENTER;
|
||||||
if (biomeID.equals(Biomes.SMALL_END_ISLANDS.location())) {
|
} else if (TheEndBiomesHelper.canGenerateAsHighlandsBiome(biomeKey)) {
|
||||||
return;
|
if (!config.withVoidBiomes) return BiomeAPI.BiomeType.END_VOID;
|
||||||
}
|
return BiomeAPI.BiomeType.END_LAND;
|
||||||
}
|
} else if (TheEndBiomesHelper.canGenerateAsEndBarrens(biomeKey)) {
|
||||||
|
return BiomeAPI.BiomeType.END_BARRENS;
|
||||||
|
} else if (TheEndBiomesHelper.canGenerateAsSmallIslandsBiome(biomeKey)) {
|
||||||
|
return BiomeAPI.BiomeType.END_VOID;
|
||||||
|
} else if (TheEndBiomesHelper.canGenerateAsEndMidlands(biomeKey)) {
|
||||||
|
return BiomeAPI.BiomeType.END_LAND;
|
||||||
|
}
|
||||||
|
|
||||||
//force include biomes
|
return super.typeForUnknownBiome(biomeKey, defaultType);
|
||||||
boolean didForceAdd = false;
|
}
|
||||||
for (var entry : pickerMap.entrySet()) {
|
|
||||||
var includeList = includeMap == null ? null : includeMap.get(entry.getKey());
|
|
||||||
if (includeList != null && includeList.contains(biomeStr)) {
|
|
||||||
entry.getValue().addBiome(bclBiome);
|
|
||||||
didForceAdd = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!didForceAdd) {
|
@Override
|
||||||
if (BCLBiomeRegistry.isEmptyBiome(biomeID)
|
protected void onFinishBiomeRebuild(Map<BiomeAPI.BiomeType, BiomePicker> pickerMap) {
|
||||||
|| bclBiome.getIntendedType().is(BiomeAPI.BiomeType.END_IGNORE)) {
|
super.onFinishBiomeRebuild(pickerMap);
|
||||||
//we should not add this biome anywhere, so just ignore it
|
|
||||||
} else {
|
|
||||||
didForceAdd = false;
|
|
||||||
for (BiomeDecider decider : deciders) {
|
|
||||||
if (decider.addToPicker(bclBiome)) {
|
|
||||||
didForceAdd = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!didForceAdd) {
|
|
||||||
if (bclBiome.getIntendedType().is(BiomeAPI.BiomeType.END_CENTER)
|
|
||||||
|| TheEndBiomesHelper.canGenerateAsMainIslandBiome(key)) {
|
|
||||||
endCenterBiomePicker.addBiome(bclBiome);
|
|
||||||
} else if (bclBiome.getIntendedType().is(BiomeAPI.BiomeType.END_LAND)
|
|
||||||
|| TheEndBiomesHelper.canGenerateAsHighlandsBiome(key)) {
|
|
||||||
if (!config.withVoidBiomes) endVoidBiomePicker.addBiome(bclBiome);
|
|
||||||
endLandBiomePicker.addBiome(bclBiome);
|
|
||||||
} else if (bclBiome.getIntendedType().is(BiomeAPI.BiomeType.END_BARRENS)
|
|
||||||
|| TheEndBiomesHelper.canGenerateAsEndBarrens(key)) {
|
|
||||||
endBarrensBiomePicker.addBiome(bclBiome);
|
|
||||||
} else if (bclBiome.getIntendedType().is(BiomeAPI.BiomeType.END_VOID)
|
|
||||||
|| TheEndBiomesHelper.canGenerateAsSmallIslandsBiome(key)) {
|
|
||||||
endVoidBiomePicker.addBiome(bclBiome);
|
|
||||||
} else {
|
|
||||||
BCLib.LOGGER.info("Found End Biome " + biomeStr + " that was not registers with fabric or bclib. Assuming end-land Biome...");
|
|
||||||
endLandBiomePicker.addBiome(bclBiome);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
endLandBiomePicker.rebuild();
|
|
||||||
endVoidBiomePicker.rebuild();
|
|
||||||
endBarrensBiomePicker.rebuild();
|
|
||||||
endCenterBiomePicker.rebuild();
|
|
||||||
|
|
||||||
for (BiomeDecider decider : deciders) {
|
for (BiomeDecider decider : deciders) {
|
||||||
decider.rebuild();
|
decider.rebuild();
|
||||||
|
@ -248,63 +189,206 @@ public class BCLibEndBiomeSource extends BCLBiomeSource implements BiomeSourceWi
|
||||||
}
|
}
|
||||||
if (endCenterBiomePicker.isEmpty()) {
|
if (endCenterBiomePicker.isEmpty()) {
|
||||||
BCLib.LOGGER.warning("No Center Island Biomes found. Forcing use of vanilla center.");
|
BCLib.LOGGER.warning("No Center Island Biomes found. Forcing use of vanilla center.");
|
||||||
endCenterBiomePicker.addBiome(BiomeAPI.THE_END);
|
endCenterBiomePicker.addBiome(BCLBiomeRegistry.THE_END);
|
||||||
endCenterBiomePicker.rebuild();
|
endCenterBiomePicker.rebuild();
|
||||||
if (endCenterBiomePicker.isEmpty()) {
|
if (endCenterBiomePicker.isEmpty()) {
|
||||||
BCLib.LOGGER.error("Unable to force vanilla central Island. Falling back to land Biomes...");
|
BCLib.LOGGER.error("Unable to force vanilla central Island. Falling back to land Biomes...");
|
||||||
endCenterBiomePicker = endLandBiomePicker;
|
endCenterBiomePicker = endLandBiomePicker;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @NotNull
|
||||||
|
// private void rebuildBiomePickers() {
|
||||||
|
// if (WorldBootstrap.getLastRegistryAccess() == null) {
|
||||||
|
// this.endLandBiomePicker = null;
|
||||||
|
// this.endVoidBiomePicker = null;
|
||||||
|
// this.endCenterBiomePicker = null;
|
||||||
|
// this.endBarrensBiomePicker = null;
|
||||||
|
// this.deciders = List.of();
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// HolderLookup.RegistryLookup<Biome> biomeRegistry = WorldBootstrap.getLastRegistryAccess()
|
||||||
|
// .lookupOrThrow(Registries.BIOME);
|
||||||
|
// Registry<BCLBiome> bclBiomeRegistry = WorldBootstrap.getLastRegistryAccess()
|
||||||
|
// .registryOrThrow(BCLBiomeRegistry.BCL_BIOMES_REGISTRY);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// var includeMap = Configs.BIOMES_CONFIG.getBiomeIncludeMap();
|
||||||
|
// var excludeList = Configs.BIOMES_CONFIG.getExcludeMatching(BiomeAPI.BiomeType.END);
|
||||||
|
//
|
||||||
|
// this.deciders = BiomeDecider.DECIDERS.stream()
|
||||||
|
// .filter(d -> d.canProvideFor(this))
|
||||||
|
// .map(d -> d.createInstance(this))
|
||||||
|
// .toList();
|
||||||
|
//
|
||||||
|
// this.endLandBiomePicker = new BiomePicker(biomeRegistry);
|
||||||
|
// this.endVoidBiomePicker = new BiomePicker(biomeRegistry);
|
||||||
|
// this.endCenterBiomePicker = new BiomePicker(biomeRegistry);
|
||||||
|
// this.endBarrensBiomePicker = new BiomePicker(biomeRegistry);
|
||||||
|
// Map<BiomeAPI.BiomeType, BiomePicker> pickerMap = new HashMap<>();
|
||||||
|
// pickerMap.put(BiomeAPI.BiomeType.END_LAND, endLandBiomePicker);
|
||||||
|
// pickerMap.put(BiomeAPI.BiomeType.END_VOID, endVoidBiomePicker);
|
||||||
|
// pickerMap.put(BiomeAPI.BiomeType.END_CENTER, endCenterBiomePicker);
|
||||||
|
// pickerMap.put(BiomeAPI.BiomeType.END_BARRENS, endBarrensBiomePicker);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// this.possibleBiomes().forEach(biome -> {
|
||||||
|
// ResourceKey<Biome> key = biome.unwrapKey().orElseThrow();
|
||||||
|
// ResourceLocation biomeID = key.location();
|
||||||
|
// String biomeStr = biomeID.toString();
|
||||||
|
// //exclude everything that was listed
|
||||||
|
// if (excludeList != null && excludeList.contains(biomeStr)) return;
|
||||||
|
// if (!biome.isBound()) {
|
||||||
|
// BCLib.LOGGER.warning("Biome " + biomeStr + " is requested but not yet bound.");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// final BCLBiome bclBiome;
|
||||||
|
// if (!bclBiomeRegistry.containsKey(biomeID)) {
|
||||||
|
// bclBiome = new BCLBiome(biomeID, BiomeAPI.BiomeType.END_LAND);
|
||||||
|
// InternalBiomeAPI.registerBCLBiomeData(bclBiome);
|
||||||
|
// } else {
|
||||||
|
// bclBiome = bclBiomeRegistry.get(biomeID);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// if (!BCLBiomeRegistry.isEmptyBiome(bclBiome)) {
|
||||||
|
// if (bclBiome.getParentBiome() == null) {
|
||||||
|
// //ignore small islands when void biomes are disabled
|
||||||
|
// if (!config.withVoidBiomes) {
|
||||||
|
// if (biomeID.equals(Biomes.SMALL_END_ISLANDS.location())) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //force include biomes
|
||||||
|
// boolean didForceAdd = false;
|
||||||
|
// for (var entry : pickerMap.entrySet()) {
|
||||||
|
// var includeList = includeMap == null ? null : includeMap.get(entry.getKey());
|
||||||
|
// if (includeList != null && includeList.contains(biomeStr)) {
|
||||||
|
// entry.getValue().addBiome(bclBiome);
|
||||||
|
// didForceAdd = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (!didForceAdd) {
|
||||||
|
// if (BCLBiomeRegistry.isEmptyBiome(biomeID)
|
||||||
|
// || bclBiome.getIntendedType().is(BiomeAPI.BiomeType.END_IGNORE)) {
|
||||||
|
// //we should not add this biome anywhere, so just ignore it
|
||||||
|
// } else {
|
||||||
|
// didForceAdd = false;
|
||||||
|
// for (BiomeDecider decider : deciders) {
|
||||||
|
// if (decider.addToPicker(bclBiome)) {
|
||||||
|
// didForceAdd = true;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (!didForceAdd) {
|
||||||
|
// if (bclBiome.getIntendedType().is(BiomeAPI.BiomeType.END_CENTER)
|
||||||
|
// || TheEndBiomesHelper.canGenerateAsMainIslandBiome(key)) {
|
||||||
|
// endCenterBiomePicker.addBiome(bclBiome);
|
||||||
|
// } else if (bclBiome.getIntendedType().is(BiomeAPI.BiomeType.END_LAND)
|
||||||
|
// || TheEndBiomesHelper.canGenerateAsHighlandsBiome(key)) {
|
||||||
|
// if (!config.withVoidBiomes) endVoidBiomePicker.addBiome(bclBiome);
|
||||||
|
// endLandBiomePicker.addBiome(bclBiome);
|
||||||
|
// } else if (bclBiome.getIntendedType().is(BiomeAPI.BiomeType.END_BARRENS)
|
||||||
|
// || TheEndBiomesHelper.canGenerateAsEndBarrens(key)) {
|
||||||
|
// endBarrensBiomePicker.addBiome(bclBiome);
|
||||||
|
// } else if (bclBiome.getIntendedType().is(BiomeAPI.BiomeType.END_VOID)
|
||||||
|
// || TheEndBiomesHelper.canGenerateAsSmallIslandsBiome(key)) {
|
||||||
|
// endVoidBiomePicker.addBiome(bclBiome);
|
||||||
|
// } else {
|
||||||
|
// BCLib.LOGGER.info("Found End Biome " + biomeStr + " that was not registers with fabric or bclib. Assuming end-land Biome...");
|
||||||
|
// endLandBiomePicker.addBiome(bclBiome);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// endLandBiomePicker.rebuild();
|
||||||
|
// endVoidBiomePicker.rebuild();
|
||||||
|
// endBarrensBiomePicker.rebuild();
|
||||||
|
// endCenterBiomePicker.rebuild();
|
||||||
|
//
|
||||||
|
// for (BiomeDecider decider : deciders) {
|
||||||
|
// decider.rebuild();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (endVoidBiomePicker.isEmpty()) {
|
||||||
|
// BCLib.LOGGER.info("No Void Biomes found. Disabling by using barrens");
|
||||||
|
// endVoidBiomePicker = endBarrensBiomePicker;
|
||||||
|
// }
|
||||||
|
// if (endBarrensBiomePicker.isEmpty()) {
|
||||||
|
// BCLib.LOGGER.info("No Barrens Biomes found. Disabling by using land Biomes");
|
||||||
|
// endBarrensBiomePicker = endLandBiomePicker;
|
||||||
|
// endVoidBiomePicker = endLandBiomePicker;
|
||||||
|
// }
|
||||||
|
// if (endCenterBiomePicker.isEmpty()) {
|
||||||
|
// BCLib.LOGGER.warning("No Center Island Biomes found. Forcing use of vanilla center.");
|
||||||
|
// endCenterBiomePicker.addBiome(BiomeAPI.THE_END);
|
||||||
|
// endCenterBiomePicker.rebuild();
|
||||||
|
// if (endCenterBiomePicker.isEmpty()) {
|
||||||
|
// BCLib.LOGGER.error("Unable to force vanilla central Island. Falling back to land Biomes...");
|
||||||
|
// endCenterBiomePicker = endLandBiomePicker;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
protected BCLBiomeSource cloneForDatapack(Set<Holder<Biome>> datapackBiomes) {
|
protected BCLBiomeSource cloneForDatapack(Set<Holder<Biome>> datapackBiomes) {
|
||||||
datapackBiomes.addAll(getNonVanillaBiomes(this.biomeRegistry, this.bclBiomeRegistry));
|
// datapackBiomes.addAll(getNonVanillaBiomes(this.biomeRegistry, this.bclBiomeRegistry));
|
||||||
datapackBiomes.addAll(possibleBiomes().stream()
|
// datapackBiomes.addAll(possibleBiomes().stream()
|
||||||
.filter(h -> !h.unwrapKey()
|
// .filter(h -> !h.unwrapKey()
|
||||||
.orElseThrow()
|
// .orElseThrow()
|
||||||
.location()
|
// .location()
|
||||||
.getNamespace()
|
// .getNamespace()
|
||||||
.equals("minecraft"))
|
// .equals("minecraft"))
|
||||||
.toList());
|
// .toList());
|
||||||
|
//
|
||||||
return new BCLibEndBiomeSource(
|
// return new BCLibEndBiomeSource(
|
||||||
this.biomeRegistry,
|
// this.biomeRegistry,
|
||||||
this.bclBiomeRegistry,
|
// this.bclBiomeRegistry,
|
||||||
datapackBiomes.stream()
|
// datapackBiomes.stream()
|
||||||
.filter(b -> b.unwrapKey()
|
// .filter(b -> b.unwrapKey()
|
||||||
.orElse(null) != BCLBiomeRegistry.EMPTY_BIOME.getBiomeKey())
|
// .orElse(null) != BCLBiomeRegistry.EMPTY_BIOME.getBiomeKey())
|
||||||
.toList(),
|
// .toList(),
|
||||||
this.currentSeed,
|
// this.currentSeed,
|
||||||
this.config,
|
// this.config,
|
||||||
true
|
// true
|
||||||
);
|
// );
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Holder<Biome>> getNonVanillaBiomes(
|
// private static List<Holder<Biome>> getNonVanillaBiomes(
|
||||||
HolderGetter<Biome> biomeRegistry,
|
// HolderGetter<Biome> biomeRegistry,
|
||||||
HolderGetter<BCLBiome> bclBiomeRegistry
|
// HolderGetter<BCLBiome> bclBiomeRegistry
|
||||||
) {
|
// ) {
|
||||||
return getBiomes(
|
// return getBiomes(
|
||||||
biomeRegistry,
|
// biomeRegistry,
|
||||||
bclBiomeRegistry,
|
// bclBiomeRegistry,
|
||||||
Configs.BIOMES_CONFIG.getExcludeMatching(BiomeAPI.BiomeType.END),
|
// Configs.BIOMES_CONFIG.getExcludeMatching(BiomeAPI.BiomeType.END),
|
||||||
Configs.BIOMES_CONFIG.getIncludeMatching(BiomeAPI.BiomeType.END),
|
// Configs.BIOMES_CONFIG.getIncludeMatching(BiomeAPI.BiomeType.END),
|
||||||
BCLibEndBiomeSource::isValidNonVanillaEndBiome
|
// BCLibEndBiomeSource::isValidNonVanillaEndBiome
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
private static List<Holder<Biome>> getBiomes(
|
// private static List<Holder<Biome>> getBiomes(
|
||||||
HolderGetter<Biome> biomeRegistry,
|
// HolderGetter<Biome> biomeRegistry,
|
||||||
HolderGetter<BCLBiome> bclBiomeRegistry
|
// HolderGetter<BCLBiome> bclBiomeRegistry
|
||||||
) {
|
// ) {
|
||||||
return getBiomes(
|
// return getBiomes(
|
||||||
biomeRegistry,
|
// biomeRegistry,
|
||||||
bclBiomeRegistry,
|
// bclBiomeRegistry,
|
||||||
Configs.BIOMES_CONFIG.getExcludeMatching(BiomeAPI.BiomeType.END),
|
// Configs.BIOMES_CONFIG.getExcludeMatching(BiomeAPI.BiomeType.END),
|
||||||
Configs.BIOMES_CONFIG.getIncludeMatching(BiomeAPI.BiomeType.END),
|
// Configs.BIOMES_CONFIG.getIncludeMatching(BiomeAPI.BiomeType.END),
|
||||||
BCLibEndBiomeSource::isValidEndBiome
|
// BCLibEndBiomeSource::isValidEndBiome
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
private static boolean isValidEndBiome(Holder<Biome> biome, ResourceLocation location) {
|
private static boolean isValidEndBiome(Holder<Biome> biome, ResourceLocation location) {
|
||||||
|
@ -373,6 +457,8 @@ public class BCLibEndBiomeSource extends BCLBiomeSource implements BiomeSourceWi
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Holder<Biome> getNoiseBiome(int biomeX, int biomeY, int biomeZ, Climate.@NotNull Sampler sampler) {
|
public Holder<Biome> getNoiseBiome(int biomeX, int biomeY, int biomeZ, Climate.@NotNull Sampler sampler) {
|
||||||
|
if (!wasBound()) reloadBiomes(false);
|
||||||
|
|
||||||
if (mapLand == null || mapVoid == null || mapCenter == null || mapBarrens == null)
|
if (mapLand == null || mapVoid == null || mapCenter == null || mapBarrens == null)
|
||||||
return this.possibleBiomes().stream().findFirst().orElseThrow();
|
return this.possibleBiomes().stream().findFirst().orElseThrow();
|
||||||
|
|
||||||
|
@ -444,9 +530,14 @@ public class BCLibEndBiomeSource extends BCLBiomeSource implements BiomeSourceWi
|
||||||
return CODEC;
|
return CODEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toShortString() {
|
||||||
|
return "BCLib - The End BiomeSource (" + Integer.toHexString(hashCode()) + ")";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "\nBCLib - The End BiomeSource (" + Integer.toHexString(hashCode()) + ")" +
|
return "\n" + toShortString() +
|
||||||
"\n biomes = " + possibleBiomes().size() +
|
"\n biomes = " + possibleBiomes().size() +
|
||||||
"\n namespaces = " + getNamespaces() +
|
"\n namespaces = " + getNamespaces() +
|
||||||
"\n seed = " + currentSeed +
|
"\n seed = " + currentSeed +
|
||||||
|
@ -463,12 +554,7 @@ public class BCLibEndBiomeSource extends BCLBiomeSource implements BiomeSourceWi
|
||||||
@Override
|
@Override
|
||||||
public void setTogetherConfig(BCLEndBiomeSourceConfig newConfig) {
|
public void setTogetherConfig(BCLEndBiomeSourceConfig newConfig) {
|
||||||
this.config = newConfig;
|
this.config = newConfig;
|
||||||
this.initMap(currentSeed);
|
rebuildBiomes(true);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void reloadBiomes() {
|
|
||||||
rebuildBiomePickers();
|
|
||||||
this.initMap(currentSeed);
|
this.initMap(currentSeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,9 @@ import org.betterx.bclib.api.v2.generator.config.BCLNetherBiomeSourceConfig;
|
||||||
import org.betterx.bclib.api.v2.generator.config.MapBuilderFunction;
|
import org.betterx.bclib.api.v2.generator.config.MapBuilderFunction;
|
||||||
import org.betterx.bclib.api.v2.generator.map.MapStack;
|
import org.betterx.bclib.api.v2.generator.map.MapStack;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeRegistry;
|
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.InternalBiomeAPI;
|
|
||||||
import org.betterx.bclib.config.Configs;
|
|
||||||
import org.betterx.bclib.interfaces.BiomeMap;
|
import org.betterx.bclib.interfaces.BiomeMap;
|
||||||
import org.betterx.worlds.together.biomesource.BiomeSourceWithConfig;
|
import org.betterx.worlds.together.biomesource.BiomeSourceWithConfig;
|
||||||
import org.betterx.worlds.together.biomesource.ReloadableBiomeSource;
|
|
||||||
import org.betterx.worlds.together.world.event.WorldBootstrap;
|
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
|
@ -20,8 +15,7 @@ import net.minecraft.core.Holder;
|
||||||
import net.minecraft.core.HolderGetter;
|
import net.minecraft.core.HolderGetter;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.resources.RegistryOps;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.tags.BiomeTags;
|
import net.minecraft.tags.BiomeTags;
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
|
@ -31,14 +25,13 @@ import net.minecraft.world.level.biome.Climate;
|
||||||
import net.fabricmc.fabric.api.biome.v1.NetherBiomes;
|
import net.fabricmc.fabric.api.biome.v1.NetherBiomes;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class BCLibNetherBiomeSource extends BCLBiomeSource implements BiomeSourceWithConfig<BCLibNetherBiomeSource, BCLNetherBiomeSourceConfig>, ReloadableBiomeSource {
|
public class BCLibNetherBiomeSource extends BCLBiomeSource implements BiomeSourceWithConfig<BCLibNetherBiomeSource, BCLNetherBiomeSourceConfig> {
|
||||||
public static final Codec<BCLibNetherBiomeSource> CODEC = RecordCodecBuilder
|
public static final Codec<BCLibNetherBiomeSource> CODEC = RecordCodecBuilder
|
||||||
.create(instance -> instance
|
.create(instance -> instance
|
||||||
.group(
|
.group(
|
||||||
RegistryOps.retrieveGetter(Registries.BIOME),
|
|
||||||
RegistryOps.retrieveGetter(BCLBiomeRegistry.BCL_BIOMES_REGISTRY),
|
|
||||||
Codec
|
Codec
|
||||||
.LONG
|
.LONG
|
||||||
.fieldOf("seed")
|
.fieldOf("seed")
|
||||||
|
@ -59,118 +52,123 @@ public class BCLibNetherBiomeSource extends BCLBiomeSource implements BiomeSourc
|
||||||
private BCLNetherBiomeSourceConfig config;
|
private BCLNetherBiomeSourceConfig config;
|
||||||
|
|
||||||
public BCLibNetherBiomeSource(
|
public BCLibNetherBiomeSource(
|
||||||
HolderGetter<Biome> biomeRegistry,
|
|
||||||
HolderGetter<BCLBiome> bclBiomeRegistry,
|
|
||||||
BCLNetherBiomeSourceConfig config
|
BCLNetherBiomeSourceConfig config
|
||||||
) {
|
) {
|
||||||
this(biomeRegistry, bclBiomeRegistry, 0, config, false);
|
this(0, config, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BCLibNetherBiomeSource(
|
private BCLibNetherBiomeSource(
|
||||||
HolderGetter<Biome> biomeRegistry,
|
|
||||||
HolderGetter<BCLBiome> bclBiomeRegistry,
|
|
||||||
long seed,
|
long seed,
|
||||||
BCLNetherBiomeSourceConfig config
|
BCLNetherBiomeSourceConfig config
|
||||||
) {
|
) {
|
||||||
this(biomeRegistry, bclBiomeRegistry, seed, config, true);
|
this(seed, config, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private BCLibNetherBiomeSource(
|
private BCLibNetherBiomeSource(
|
||||||
HolderGetter<Biome> biomeRegistry,
|
|
||||||
HolderGetter<BCLBiome> bclBiomeRegistry,
|
|
||||||
long seed,
|
long seed,
|
||||||
BCLNetherBiomeSourceConfig config,
|
BCLNetherBiomeSourceConfig config,
|
||||||
boolean initMaps
|
boolean initMaps
|
||||||
) {
|
) {
|
||||||
this(biomeRegistry, bclBiomeRegistry, getBiomes(biomeRegistry, bclBiomeRegistry), seed, config, initMaps);
|
super(seed);
|
||||||
}
|
|
||||||
|
|
||||||
private BCLibNetherBiomeSource(
|
|
||||||
HolderGetter<Biome> biomeRegistry,
|
|
||||||
HolderGetter<BCLBiome> bclBiomeRegistry,
|
|
||||||
List<Holder<Biome>> list,
|
|
||||||
long seed,
|
|
||||||
BCLNetherBiomeSourceConfig config,
|
|
||||||
boolean initMaps
|
|
||||||
) {
|
|
||||||
super(biomeRegistry, bclBiomeRegistry, list, seed);
|
|
||||||
this.config = config;
|
this.config = config;
|
||||||
rebuildBiomePicker();
|
rebuildBiomes(false);
|
||||||
if (initMaps) {
|
if (initMaps) {
|
||||||
initMap(seed);
|
initMap(seed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rebuildBiomePicker() {
|
@Override
|
||||||
if (WorldBootstrap.getLastRegistryAccess() == null) {
|
protected BiomeAPI.BiomeType defaultBiomeType() {
|
||||||
biomePicker = new BiomePicker(null);
|
return BiomeAPI.BiomeType.NETHER;
|
||||||
return;
|
|
||||||
}
|
|
||||||
biomePicker = new BiomePicker(WorldBootstrap.getLastRegistryAccess().lookupOrThrow(Registries.BIOME));
|
|
||||||
Registry<BCLBiome> bclBiomeRegistry = WorldBootstrap.getLastRegistryAccess()
|
|
||||||
.registryOrThrow(BCLBiomeRegistry.BCL_BIOMES_REGISTRY);
|
|
||||||
this.possibleBiomes().forEach(biome -> {
|
|
||||||
ResourceLocation biomeID = biome.unwrapKey().orElseThrow().location();
|
|
||||||
if (!biome.isBound()) {
|
|
||||||
BCLib.LOGGER.warning("Biome " + biomeID.toString() + " is requested but not yet bound.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!bclBiomeRegistry.containsKey(biomeID)) {
|
|
||||||
BCLBiome bclBiome = new BCLBiome(biomeID, BiomeAPI.BiomeType.NETHER);
|
|
||||||
InternalBiomeAPI.registerBCLBiomeData(bclBiome);
|
|
||||||
biomePicker.addBiome(bclBiome);
|
|
||||||
} else {
|
|
||||||
BCLBiome bclBiome = bclBiomeRegistry.get(biomeID);
|
|
||||||
|
|
||||||
if (!BCLBiomeRegistry.isEmptyBiome(bclBiome)) {
|
|
||||||
if (bclBiome.getParentBiome() == null) {
|
|
||||||
biomePicker.addBiome(bclBiome);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
biomePicker.rebuild();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Map<BiomeAPI.BiomeType, BiomePicker> createFreshPickerMap() {
|
||||||
|
this.biomePicker = new BiomePicker();
|
||||||
|
return Map.of(defaultBiomeType(), this.biomePicker);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BiomeAPI.BiomeType typeForUnknownBiome(ResourceKey<Biome> biomeKey, BiomeAPI.BiomeType defaultType) {
|
||||||
|
//
|
||||||
|
if (NetherBiomes.canGenerateInNether(biomeKey)) {
|
||||||
|
return BiomeAPI.BiomeType.NETHER;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.typeForUnknownBiome(biomeKey, defaultType);
|
||||||
|
}
|
||||||
|
|
||||||
|
// private void rebuildBiomePicker() {
|
||||||
|
// if (WorldBootstrap.getLastRegistryAccess() == null) {
|
||||||
|
// biomePicker = new BiomePicker(null);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// biomePicker = new BiomePicker(WorldBootstrap.getLastRegistryAccess().lookupOrThrow(Registries.BIOME));
|
||||||
|
// Registry<BCLBiome> bclBiomeRegistry = WorldBootstrap.getLastRegistryAccess()
|
||||||
|
// .registryOrThrow(BCLBiomeRegistry.BCL_BIOMES_REGISTRY);
|
||||||
|
// this.possibleBiomes().forEach(biome -> {
|
||||||
|
// ResourceLocation biomeID = biome.unwrapKey().orElseThrow().location();
|
||||||
|
// if (!biome.isBound()) {
|
||||||
|
// BCLib.LOGGER.warning("Biome " + biomeID.toString() + " is requested but not yet bound.");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// if (!bclBiomeRegistry.containsKey(biomeID)) {
|
||||||
|
// BCLBiome bclBiome = new BCLBiome(biomeID, BiomeAPI.BiomeType.NETHER);
|
||||||
|
// InternalBiomeAPI.registerBCLBiomeData(bclBiome);
|
||||||
|
// biomePicker.addBiome(bclBiome);
|
||||||
|
// } else {
|
||||||
|
// BCLBiome bclBiome = bclBiomeRegistry.get(biomeID);
|
||||||
|
//
|
||||||
|
// if (!BCLBiomeRegistry.isEmptyBiome(bclBiome)) {
|
||||||
|
// if (bclBiome.getParentBiome() == null) {
|
||||||
|
// biomePicker.addBiome(bclBiome);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// biomePicker.rebuild();
|
||||||
|
// }
|
||||||
|
|
||||||
protected BCLBiomeSource cloneForDatapack(Set<Holder<Biome>> datapackBiomes) {
|
protected BCLBiomeSource cloneForDatapack(Set<Holder<Biome>> datapackBiomes) {
|
||||||
datapackBiomes.addAll(getNonVanillaBiomes(this.biomeRegistry, this.bclBiomeRegistry));
|
// datapackBiomes.addAll(getNonVanillaBiomes(this.biomeRegistry, this.bclBiomeRegistry));
|
||||||
datapackBiomes.addAll(possibleBiomes().stream()
|
// datapackBiomes.addAll(possibleBiomes().stream()
|
||||||
.filter(h -> !h.unwrapKey()
|
// .filter(h -> !h.unwrapKey()
|
||||||
.orElseThrow()
|
// .orElseThrow()
|
||||||
.location()
|
// .location()
|
||||||
.getNamespace()
|
// .getNamespace()
|
||||||
.equals("minecraft"))
|
// .equals("minecraft"))
|
||||||
.toList());
|
// .toList());
|
||||||
return new BCLibNetherBiomeSource(
|
// return new BCLibNetherBiomeSource(
|
||||||
this.biomeRegistry,
|
// datapackBiomes.stream()
|
||||||
this.bclBiomeRegistry,
|
// .filter(b -> b.unwrapKey()
|
||||||
datapackBiomes.stream()
|
// .orElse(null) != BCLBiomeRegistry.EMPTY_BIOME.getBiomeKey())
|
||||||
.filter(b -> b.unwrapKey()
|
// .toList(),
|
||||||
.orElse(null) != BCLBiomeRegistry.EMPTY_BIOME.getBiomeKey())
|
// this.currentSeed,
|
||||||
.toList(),
|
// config,
|
||||||
this.currentSeed,
|
// true
|
||||||
config,
|
// );
|
||||||
true
|
return null;
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Holder<Biome>> getNonVanillaBiomes(
|
private static List<Holder<Biome>> getNonVanillaBiomes(
|
||||||
HolderGetter<Biome> biomeRegistry,
|
HolderGetter<Biome> biomeRegistry,
|
||||||
HolderGetter<BCLBiome> bclBiomeRegistry
|
HolderGetter<BCLBiome> bclBiomeRegistry
|
||||||
) {
|
) {
|
||||||
List<String> include = Configs.BIOMES_CONFIG.getIncludeMatching(BiomeAPI.BiomeType.NETHER);
|
// List<String> include = Configs.BIOMES_CONFIG.getIncludeMatching(BiomeAPI.BiomeType.NETHER);
|
||||||
List<String> exclude = Configs.BIOMES_CONFIG.getExcludeMatching(BiomeAPI.BiomeType.NETHER);
|
// List<String> exclude = Configs.BIOMES_CONFIG.getExcludeMatching(BiomeAPI.BiomeType.NETHER);
|
||||||
|
//
|
||||||
return getBiomes(
|
// return getBiomes(
|
||||||
biomeRegistry,
|
// biomeRegistry,
|
||||||
bclBiomeRegistry,
|
// bclBiomeRegistry,
|
||||||
exclude,
|
// exclude,
|
||||||
include,
|
// include,
|
||||||
BCLibNetherBiomeSource::isValidNonVanillaNetherBiome
|
// BCLibNetherBiomeSource::isValidNonVanillaNetherBiome
|
||||||
);
|
// );
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -178,10 +176,11 @@ public class BCLibNetherBiomeSource extends BCLBiomeSource implements BiomeSourc
|
||||||
HolderGetter<Biome> biomeRegistry,
|
HolderGetter<Biome> biomeRegistry,
|
||||||
HolderGetter<BCLBiome> bclBiomeRegistry
|
HolderGetter<BCLBiome> bclBiomeRegistry
|
||||||
) {
|
) {
|
||||||
List<String> include = Configs.BIOMES_CONFIG.getIncludeMatching(BiomeAPI.BiomeType.NETHER);
|
// List<String> include = Configs.BIOMES_CONFIG.getIncludeMatching(BiomeAPI.BiomeType.NETHER);
|
||||||
List<String> exclude = Configs.BIOMES_CONFIG.getExcludeMatching(BiomeAPI.BiomeType.NETHER);
|
// List<String> exclude = Configs.BIOMES_CONFIG.getExcludeMatching(BiomeAPI.BiomeType.NETHER);
|
||||||
|
//
|
||||||
return getBiomes(biomeRegistry, bclBiomeRegistry, exclude, include, BCLibNetherBiomeSource::isValidNetherBiome);
|
// return getBiomes(biomeRegistry, bclBiomeRegistry, exclude, include, BCLibNetherBiomeSource::isValidNetherBiome);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -210,6 +209,8 @@ public class BCLibNetherBiomeSource extends BCLBiomeSource implements BiomeSourc
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Holder<Biome> getNoiseBiome(int biomeX, int biomeY, int biomeZ, Climate.Sampler var4) {
|
public Holder<Biome> getNoiseBiome(int biomeX, int biomeY, int biomeZ, Climate.Sampler var4) {
|
||||||
|
if (!wasBound()) reloadBiomes(false);
|
||||||
|
|
||||||
if (biomeMap == null)
|
if (biomeMap == null)
|
||||||
return this.possibleBiomes().stream().findFirst().get();
|
return this.possibleBiomes().stream().findFirst().get();
|
||||||
|
|
||||||
|
@ -251,9 +252,14 @@ public class BCLibNetherBiomeSource extends BCLBiomeSource implements BiomeSourc
|
||||||
initMap(currentSeed);
|
initMap(currentSeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toShortString() {
|
||||||
|
return "BCLib - Nether BiomeSource (" + Integer.toHexString(hashCode()) + ")";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "\nBCLib - Nether BiomeSource (" + Integer.toHexString(hashCode()) + ")" +
|
return "\n" + toShortString() +
|
||||||
"\n biomes = " + possibleBiomes().size() +
|
"\n biomes = " + possibleBiomes().size() +
|
||||||
"\n namespaces = " + getNamespaces() +
|
"\n namespaces = " + getNamespaces() +
|
||||||
"\n seed = " + currentSeed +
|
"\n seed = " + currentSeed +
|
||||||
|
@ -271,10 +277,4 @@ public class BCLibNetherBiomeSource extends BCLBiomeSource implements BiomeSourc
|
||||||
this.config = newConfig;
|
this.config = newConfig;
|
||||||
initMap(currentSeed);
|
initMap(currentSeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void reloadBiomes() {
|
|
||||||
rebuildBiomePicker();
|
|
||||||
initMap(currentSeed);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,11 @@ import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
||||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeRegistry;
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeRegistry;
|
||||||
import org.betterx.bclib.util.WeighTree;
|
import org.betterx.bclib.util.WeighTree;
|
||||||
import org.betterx.bclib.util.WeightedList;
|
import org.betterx.bclib.util.WeightedList;
|
||||||
|
import org.betterx.worlds.together.world.event.WorldBootstrap;
|
||||||
|
|
||||||
import net.minecraft.core.Holder;
|
import net.minecraft.core.Holder;
|
||||||
import net.minecraft.core.HolderGetter;
|
import net.minecraft.core.HolderGetter;
|
||||||
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
|
@ -27,6 +29,16 @@ public class BiomePicker {
|
||||||
public final ActualBiome fallbackBiome;
|
public final ActualBiome fallbackBiome;
|
||||||
private WeighTree<ActualBiome> tree;
|
private WeighTree<ActualBiome> tree;
|
||||||
|
|
||||||
|
BiomePicker() {
|
||||||
|
this(WorldBootstrap.getLastRegistryAccess() == null
|
||||||
|
? null
|
||||||
|
: WorldBootstrap.getLastRegistryAccess().registry(Registries.BIOME).orElse(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
public BiomePicker(Registry<Biome> biomeRegistry) {
|
||||||
|
this(biomeRegistry != null ? biomeRegistry.asLookup() : null, null);
|
||||||
|
}
|
||||||
|
|
||||||
public BiomePicker(HolderGetter<Biome> biomeRegistry) {
|
public BiomePicker(HolderGetter<Biome> biomeRegistry) {
|
||||||
this(biomeRegistry, null);
|
this(biomeRegistry, null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class LevelGenUtil {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static LevelStem getBCLNetherLevelStem(WorldGenUtil.Context context, BCLNetherBiomeSourceConfig config) {
|
public static LevelStem getBCLNetherLevelStem(WorldGenUtil.Context context, BCLNetherBiomeSourceConfig config) {
|
||||||
BCLibNetherBiomeSource netherSource = new BCLibNetherBiomeSource(context.biomes, context.bclBiomes, config);
|
BCLibNetherBiomeSource netherSource = new BCLibNetherBiomeSource(config);
|
||||||
|
|
||||||
return new LevelStem(
|
return new LevelStem(
|
||||||
context.dimension,
|
context.dimension,
|
||||||
|
|
|
@ -5,6 +5,7 @@ import org.betterx.worlds.together.WorldsTogether;
|
||||||
import org.betterx.worlds.together.world.event.WorldBootstrap;
|
import org.betterx.worlds.together.world.event.WorldBootstrap;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
|
import com.mojang.serialization.Lifecycle;
|
||||||
import net.minecraft.core.MappedRegistry;
|
import net.minecraft.core.MappedRegistry;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.core.RegistryAccess;
|
import net.minecraft.core.RegistryAccess;
|
||||||
|
@ -12,6 +13,7 @@ import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.util.KeyDispatchDataCodec;
|
import net.minecraft.util.KeyDispatchDataCodec;
|
||||||
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.biome.Biomes;
|
import net.minecraft.world.level.biome.Biomes;
|
||||||
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
@ -29,7 +31,10 @@ public class BCLBiomeRegistry {
|
||||||
BCL_BIOME_CODEC_REGISTRY,
|
BCL_BIOME_CODEC_REGISTRY,
|
||||||
BCLBiomeRegistry::bootstrapCodecs
|
BCLBiomeRegistry::bootstrapCodecs
|
||||||
);
|
);
|
||||||
public static MappedRegistry<BCLBiome> BUILTIN_BCL_BIOMES = null;
|
public static Registry<BCLBiome> BUILTIN_BCL_BIOMES = new MappedRegistry<>(
|
||||||
|
BCL_BIOMES_REGISTRY,
|
||||||
|
Lifecycle.stable()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Empty biome used as default value if requested biome doesn't exist or linked. Shouldn't be registered anywhere to prevent bugs.
|
* Empty biome used as default value if requested biome doesn't exist or linked. Shouldn't be registered anywhere to prevent bugs.
|
||||||
|
@ -37,6 +42,13 @@ public class BCLBiomeRegistry {
|
||||||
**/
|
**/
|
||||||
public static final BCLBiome EMPTY_BIOME = new BCLBiome(Biomes.THE_VOID.location());
|
public static final BCLBiome EMPTY_BIOME = new BCLBiome(Biomes.THE_VOID.location());
|
||||||
|
|
||||||
|
public static final BCLBiome THE_END = new BCLBiome(Biomes.THE_END.location(), InternalBiomeAPI.OTHER_END_CENTER);
|
||||||
|
// InternalBiomeAPI.wrapNativeBiome(
|
||||||
|
// Biomes.THE_END,
|
||||||
|
// 0.5F,
|
||||||
|
// InternalBiomeAPI.OTHER_END_CENTER
|
||||||
|
// );
|
||||||
|
|
||||||
public static boolean isEmptyBiome(ResourceLocation l) {
|
public static boolean isEmptyBiome(ResourceLocation l) {
|
||||||
return l == null || Biomes.THE_VOID.location().equals(l);
|
return l == null || Biomes.THE_VOID.location().equals(l);
|
||||||
}
|
}
|
||||||
|
@ -65,22 +77,42 @@ public class BCLBiomeRegistry {
|
||||||
/**
|
/**
|
||||||
* Register new Biome Data
|
* Register new Biome Data
|
||||||
*
|
*
|
||||||
* @param access The {@link RegistryAccess} to use. If null, we will use the
|
* @param biome The Biome Data to register
|
||||||
* built inregistry ({@link BCLBiomeRegistry#BUILTIN_BCL_BIOMES})
|
|
||||||
* @param biome The Biome Data to register
|
|
||||||
* @return The resource-key for the registry
|
* @return The resource-key for the registry
|
||||||
*/
|
*/
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
public static ResourceKey<BCLBiome> register(RegistryAccess access, BCLBiome biome) {
|
public static ResourceKey<BCLBiome> registerForDatagen(BCLBiome biome) {
|
||||||
if (access != null && BUILTIN_BCL_BIOMES == null) return biome.getBCLBiomeKey();
|
if (BUILTIN_BCL_BIOMES == null) return biome.getBCLBiomeKey();
|
||||||
|
|
||||||
Registry.register(
|
Registry.register(
|
||||||
access == null ? BUILTIN_BCL_BIOMES : access.registryOrThrow(BCL_BIOMES_REGISTRY),
|
BUILTIN_BCL_BIOMES,
|
||||||
biome.getBCLBiomeKey(),
|
biome.getBCLBiomeKey(),
|
||||||
biome
|
biome
|
||||||
);
|
);
|
||||||
|
|
||||||
return biome.getBCLBiomeKey();
|
return biome.getBCLBiomeKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void register(BCLBiome biome) {
|
||||||
|
registerForDatagen(biome);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean hasBiome(ResourceKey<Biome> key, Registry<BCLBiome> bclBiomes) {
|
||||||
|
if (bclBiomes != null && bclBiomes.containsKey(key.location())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return BUILTIN_BCL_BIOMES.containsKey(key.location());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BCLBiome getBiome(ResourceKey<Biome> key, Registry<BCLBiome> bclBiomes) {
|
||||||
|
if (bclBiomes != null && bclBiomes.containsKey(key.location())) {
|
||||||
|
return bclBiomes.get(key.location());
|
||||||
|
}
|
||||||
|
|
||||||
|
return BUILTIN_BCL_BIOMES.get(key.location());
|
||||||
|
}
|
||||||
|
|
||||||
private static <T> ResourceKey<Registry<T>> createRegistryKey(ResourceLocation location) {
|
private static <T> ResourceKey<Registry<T>> createRegistryKey(ResourceLocation location) {
|
||||||
return ResourceKey.createRegistryKey(location);
|
return ResourceKey.createRegistryKey(location);
|
||||||
}
|
}
|
||||||
|
@ -90,42 +122,6 @@ public class BCLBiomeRegistry {
|
||||||
return Registry.register(registry, BCLib.makeID("biome"), BCLBiome.KEY_CODEC.codec());
|
return Registry.register(registry, BCLib.makeID("biome"), BCLBiome.KEY_CODEC.codec());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiStatus.Internal
|
|
||||||
public static BCLBiome bootstrap(Registry<BCLBiome> registry) {
|
|
||||||
Registry.register(registry, BiomeAPI.SMALL_END_ISLANDS.getBCLBiomeKey(), BiomeAPI.SMALL_END_ISLANDS);
|
|
||||||
Registry.register(registry, BiomeAPI.END_BARRENS.getBCLBiomeKey(), BiomeAPI.END_BARRENS);
|
|
||||||
Registry.register(registry, BiomeAPI.END_HIGHLANDS.getBCLBiomeKey(), BiomeAPI.END_HIGHLANDS);
|
|
||||||
Registry.register(registry, BiomeAPI.END_MIDLANDS.getBCLBiomeKey(), BiomeAPI.END_MIDLANDS);
|
|
||||||
Registry.register(registry, BiomeAPI.THE_END.getBCLBiomeKey(), BiomeAPI.THE_END);
|
|
||||||
Registry.register(
|
|
||||||
registry,
|
|
||||||
BiomeAPI.BASALT_DELTAS_BIOME.getBCLBiomeKey(),
|
|
||||||
BiomeAPI.BASALT_DELTAS_BIOME
|
|
||||||
);
|
|
||||||
Registry.register(
|
|
||||||
registry,
|
|
||||||
BiomeAPI.SOUL_SAND_VALLEY_BIOME.getBCLBiomeKey(),
|
|
||||||
BiomeAPI.SOUL_SAND_VALLEY_BIOME
|
|
||||||
);
|
|
||||||
Registry.register(
|
|
||||||
registry,
|
|
||||||
BiomeAPI.WARPED_FOREST_BIOME.getBCLBiomeKey(),
|
|
||||||
BiomeAPI.WARPED_FOREST_BIOME
|
|
||||||
);
|
|
||||||
Registry.register(
|
|
||||||
registry,
|
|
||||||
BiomeAPI.CRIMSON_FOREST_BIOME.getBCLBiomeKey(),
|
|
||||||
BiomeAPI.CRIMSON_FOREST_BIOME
|
|
||||||
);
|
|
||||||
Registry.register(
|
|
||||||
registry,
|
|
||||||
BiomeAPI.NETHER_WASTES_BIOME.getBCLBiomeKey(),
|
|
||||||
BiomeAPI.NETHER_WASTES_BIOME
|
|
||||||
);
|
|
||||||
return Registry.register(registry, EMPTY_BIOME.getBCLBiomeKey(), EMPTY_BIOME);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BCLBiome get(ResourceLocation loc) {
|
public static BCLBiome get(ResourceLocation loc) {
|
||||||
return get(WorldBootstrap.getLastRegistryAccess(), loc);
|
return get(WorldBootstrap.getLastRegistryAccess(), loc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.LevelAccessor;
|
import net.minecraft.world.level.LevelAccessor;
|
||||||
import net.minecraft.world.level.WorldGenLevel;
|
import net.minecraft.world.level.WorldGenLevel;
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.biome.Biomes;
|
|
||||||
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
|
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||||
|
@ -228,60 +227,6 @@ public class BiomeAPI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final BCLBiome NETHER_WASTES_BIOME = InternalBiomeAPI.wrapNativeBiome(
|
|
||||||
Biomes.NETHER_WASTES,
|
|
||||||
InternalBiomeAPI.OTHER_NETHER
|
|
||||||
);
|
|
||||||
public static final BCLBiome CRIMSON_FOREST_BIOME = InternalBiomeAPI.wrapNativeBiome(
|
|
||||||
Biomes.CRIMSON_FOREST,
|
|
||||||
InternalBiomeAPI.OTHER_NETHER
|
|
||||||
);
|
|
||||||
public static final BCLBiome WARPED_FOREST_BIOME = InternalBiomeAPI.wrapNativeBiome(
|
|
||||||
Biomes.WARPED_FOREST,
|
|
||||||
InternalBiomeAPI.OTHER_NETHER
|
|
||||||
);
|
|
||||||
public static final BCLBiome SOUL_SAND_VALLEY_BIOME = InternalBiomeAPI.wrapNativeBiome(
|
|
||||||
Biomes.SOUL_SAND_VALLEY,
|
|
||||||
InternalBiomeAPI.OTHER_NETHER
|
|
||||||
);
|
|
||||||
public static final BCLBiome BASALT_DELTAS_BIOME = InternalBiomeAPI.wrapNativeBiome(
|
|
||||||
Biomes.BASALT_DELTAS,
|
|
||||||
InternalBiomeAPI.OTHER_NETHER
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
public static final BCLBiome THE_END = InternalBiomeAPI.wrapNativeBiome(
|
|
||||||
Biomes.THE_END,
|
|
||||||
0.5F,
|
|
||||||
InternalBiomeAPI.OTHER_END_CENTER
|
|
||||||
);
|
|
||||||
|
|
||||||
public static final BCLBiome END_MIDLANDS = InternalBiomeAPI.wrapNativeBiome(
|
|
||||||
Biomes.END_MIDLANDS,
|
|
||||||
0.5F,
|
|
||||||
InternalBiomeAPI.OTHER_END_LAND
|
|
||||||
);
|
|
||||||
|
|
||||||
public static final BCLBiome END_HIGHLANDS = InternalBiomeAPI.wrapNativeBiome(
|
|
||||||
Biomes.END_HIGHLANDS,
|
|
||||||
END_MIDLANDS,
|
|
||||||
8,
|
|
||||||
0.5F,
|
|
||||||
InternalBiomeAPI.OTHER_END_LAND
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
public static final BCLBiome END_BARRENS = InternalBiomeAPI.wrapNativeBiome(
|
|
||||||
Biomes.END_BARRENS,
|
|
||||||
InternalBiomeAPI.OTHER_END_BARRENS
|
|
||||||
);
|
|
||||||
|
|
||||||
public static final BCLBiome SMALL_END_ISLANDS = InternalBiomeAPI.wrapNativeBiome(
|
|
||||||
Biomes.SMALL_END_ISLANDS,
|
|
||||||
InternalBiomeAPI.OTHER_END_VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register {@link BCLBiome} instance and its {@link Biome} if necessary.
|
* Register {@link BCLBiome} instance and its {@link Biome} if necessary.
|
||||||
*
|
*
|
||||||
|
@ -296,7 +241,7 @@ public class BiomeAPI {
|
||||||
&& registryOrNull.get(bclbiome.getBiomeKey()).map(v -> v.isBound()).orElse(false) == false) {
|
&& registryOrNull.get(bclbiome.getBiomeKey()).map(v -> v.isBound()).orElse(false) == false) {
|
||||||
bootstrapContext.register(bclbiome.getBiomeKey(), bclbiome._getBiomeToRegister());
|
bootstrapContext.register(bclbiome.getBiomeKey(), bclbiome._getBiomeToRegister());
|
||||||
|
|
||||||
BCLBiomeRegistry.register(null, bclbiome);
|
BCLBiomeRegistry.registerForDatagen(bclbiome);
|
||||||
}
|
}
|
||||||
|
|
||||||
return finishBiomeRegistration(bclbiome);
|
return finishBiomeRegistration(bclbiome);
|
||||||
|
|
|
@ -290,15 +290,6 @@ public class InternalBiomeAPI {
|
||||||
return BIOME_ADDITIONS.computeIfAbsent(registry, reg -> new AtomicInteger(0)).get();
|
return BIOME_ADDITIONS.computeIfAbsent(registry, reg -> new AtomicInteger(0)).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerBCLBiomeData(BCLBiome biome) {
|
|
||||||
try {
|
|
||||||
BCLBiomeRegistry.register(registryAccess, biome);
|
|
||||||
} catch (IllegalStateException e) {
|
|
||||||
if (Configs.MAIN_CONFIG.verboseLogging())
|
|
||||||
BCLib.LOGGER.info("Not managing Biome " + biome.getID());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register {@link BCLBiome} instance and its {@link Biome} if necessary.
|
* Register {@link BCLBiome} instance and its {@link Biome} if necessary.
|
||||||
*
|
*
|
||||||
|
|
|
@ -32,15 +32,12 @@ public abstract class BuiltinRegistriesMixin {
|
||||||
private static void bcl_registerBuiltin(CallbackInfo ci) {
|
private static void bcl_registerBuiltin(CallbackInfo ci) {
|
||||||
BCLBiomeRegistry.ensureStaticallyLoaded();
|
BCLBiomeRegistry.ensureStaticallyLoaded();
|
||||||
if (BCLib.isDatagen()) {
|
if (BCLib.isDatagen()) {
|
||||||
// BCLBiomeRegistry.BUILTIN_BCL_BIOMES = internalRegister(
|
// BCLBiomeRegistry.BUILTIN_BCL_BIOMES = internalRegister(
|
||||||
// BCLBiomeRegistry.BCL_BIOMES_REGISTRY,
|
// BCLBiomeRegistry.BCL_BIOMES_REGISTRY,
|
||||||
// new MappedRegistry<>(
|
// BCLBiomeRegistry.BUILTIN_BCL_BIOMES,
|
||||||
// BCLBiomeRegistry.BCL_BIOMES_REGISTRY,
|
// BCLBiomeRegistry::bootstrap,
|
||||||
// Lifecycle.stable()
|
// Lifecycle.stable()
|
||||||
// ),
|
// );
|
||||||
// BCLBiomeRegistry::bootstrap,
|
|
||||||
// Lifecycle.stable()
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.betterx.datagen.bclib.tests.TestPlacedFeatures;
|
||||||
import org.betterx.datagen.bclib.tests.TestWorldgenProvider;
|
import org.betterx.datagen.bclib.tests.TestWorldgenProvider;
|
||||||
import org.betterx.datagen.bclib.worldgen.BCLibRegistriesDataProvider;
|
import org.betterx.datagen.bclib.worldgen.BCLibRegistriesDataProvider;
|
||||||
import org.betterx.datagen.bclib.worldgen.NoiseTypesDataProvider;
|
import org.betterx.datagen.bclib.worldgen.NoiseTypesDataProvider;
|
||||||
|
import org.betterx.datagen.bclib.worldgen.VanillaBCLBiomesDataProvider;
|
||||||
import org.betterx.datagen.bclib.worldgen.WorldgenRegistriesDataProvider;
|
import org.betterx.datagen.bclib.worldgen.WorldgenRegistriesDataProvider;
|
||||||
|
|
||||||
import net.minecraft.core.RegistrySetBuilder;
|
import net.minecraft.core.RegistrySetBuilder;
|
||||||
|
@ -22,6 +23,8 @@ public class BCLibDatagen implements DataGeneratorEntrypoint {
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeDataGenerator(FabricDataGenerator dataGenerator) {
|
public void onInitializeDataGenerator(FabricDataGenerator dataGenerator) {
|
||||||
BCLib.LOGGER.info("Bootstrap onInitializeDataGenerator");
|
BCLib.LOGGER.info("Bootstrap onInitializeDataGenerator");
|
||||||
|
VanillaBCLBiomesDataProvider.create();
|
||||||
|
|
||||||
final FabricDataGenerator.Pack pack = dataGenerator.createPack();
|
final FabricDataGenerator.Pack pack = dataGenerator.createPack();
|
||||||
|
|
||||||
if (ADD_TESTS) {
|
if (ADD_TESTS) {
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
package org.betterx.datagen.bclib.worldgen;
|
||||||
|
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeRegistry;
|
||||||
|
import org.betterx.bclib.api.v2.levelgen.biomes.InternalBiomeAPI;
|
||||||
|
|
||||||
|
import net.minecraft.core.Registry;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
import net.minecraft.world.level.biome.Biomes;
|
||||||
|
|
||||||
|
public class VanillaBCLBiomesDataProvider {
|
||||||
|
private static boolean didBootstrap = false;
|
||||||
|
|
||||||
|
public static void create() {
|
||||||
|
BCLBiomeRegistry.BUILTIN_BCL_BIOMES = BuiltInRegistries.registerSimple(
|
||||||
|
BCLBiomeRegistry.BCL_BIOMES_REGISTRY,
|
||||||
|
VanillaBCLBiomesDataProvider::bootstrap
|
||||||
|
);
|
||||||
|
|
||||||
|
bootstrap(BCLBiomeRegistry.BUILTIN_BCL_BIOMES);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BCLBiome bootstrap(Registry<BCLBiome> reg) {
|
||||||
|
if (didBootstrap) return BCLBiomeRegistry.EMPTY_BIOME;
|
||||||
|
didBootstrap = true;
|
||||||
|
|
||||||
|
final BCLBiome NETHER_WASTES_BIOME = InternalBiomeAPI.wrapNativeBiome(
|
||||||
|
Biomes.NETHER_WASTES,
|
||||||
|
InternalBiomeAPI.OTHER_NETHER
|
||||||
|
);
|
||||||
|
final BCLBiome CRIMSON_FOREST_BIOME = InternalBiomeAPI.wrapNativeBiome(
|
||||||
|
Biomes.CRIMSON_FOREST,
|
||||||
|
InternalBiomeAPI.OTHER_NETHER
|
||||||
|
);
|
||||||
|
final BCLBiome WARPED_FOREST_BIOME = InternalBiomeAPI.wrapNativeBiome(
|
||||||
|
Biomes.WARPED_FOREST,
|
||||||
|
InternalBiomeAPI.OTHER_NETHER
|
||||||
|
);
|
||||||
|
final BCLBiome SOUL_SAND_VALLEY_BIOME = InternalBiomeAPI.wrapNativeBiome(
|
||||||
|
Biomes.SOUL_SAND_VALLEY,
|
||||||
|
InternalBiomeAPI.OTHER_NETHER
|
||||||
|
);
|
||||||
|
final BCLBiome BASALT_DELTAS_BIOME = InternalBiomeAPI.wrapNativeBiome(
|
||||||
|
Biomes.BASALT_DELTAS,
|
||||||
|
InternalBiomeAPI.OTHER_NETHER
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
final BCLBiome END_MIDLANDS = InternalBiomeAPI.wrapNativeBiome(
|
||||||
|
Biomes.END_MIDLANDS,
|
||||||
|
0.5F,
|
||||||
|
InternalBiomeAPI.OTHER_END_LAND
|
||||||
|
);
|
||||||
|
|
||||||
|
final BCLBiome END_HIGHLANDS = InternalBiomeAPI.wrapNativeBiome(
|
||||||
|
Biomes.END_HIGHLANDS,
|
||||||
|
END_MIDLANDS,
|
||||||
|
8,
|
||||||
|
0.5F,
|
||||||
|
InternalBiomeAPI.OTHER_END_LAND
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
final BCLBiome END_BARRENS = InternalBiomeAPI.wrapNativeBiome(
|
||||||
|
Biomes.END_BARRENS,
|
||||||
|
InternalBiomeAPI.OTHER_END_BARRENS
|
||||||
|
);
|
||||||
|
|
||||||
|
final BCLBiome SMALL_END_ISLANDS = InternalBiomeAPI.wrapNativeBiome(
|
||||||
|
Biomes.SMALL_END_ISLANDS,
|
||||||
|
InternalBiomeAPI.OTHER_END_VOID
|
||||||
|
);
|
||||||
|
Registry.register(reg, SMALL_END_ISLANDS.getBCLBiomeKey(), SMALL_END_ISLANDS);
|
||||||
|
Registry.register(reg, END_BARRENS.getBCLBiomeKey(), END_BARRENS);
|
||||||
|
Registry.register(reg, END_HIGHLANDS.getBCLBiomeKey(), END_HIGHLANDS);
|
||||||
|
Registry.register(reg, END_MIDLANDS.getBCLBiomeKey(), END_MIDLANDS);
|
||||||
|
Registry.register(reg, BCLBiomeRegistry.THE_END.getBCLBiomeKey(), BCLBiomeRegistry.THE_END);
|
||||||
|
Registry.register(
|
||||||
|
reg,
|
||||||
|
BASALT_DELTAS_BIOME.getBCLBiomeKey(),
|
||||||
|
BASALT_DELTAS_BIOME
|
||||||
|
);
|
||||||
|
Registry.register(
|
||||||
|
reg,
|
||||||
|
SOUL_SAND_VALLEY_BIOME.getBCLBiomeKey(),
|
||||||
|
SOUL_SAND_VALLEY_BIOME
|
||||||
|
);
|
||||||
|
Registry.register(
|
||||||
|
reg,
|
||||||
|
WARPED_FOREST_BIOME.getBCLBiomeKey(),
|
||||||
|
WARPED_FOREST_BIOME
|
||||||
|
);
|
||||||
|
Registry.register(
|
||||||
|
reg,
|
||||||
|
CRIMSON_FOREST_BIOME.getBCLBiomeKey(),
|
||||||
|
CRIMSON_FOREST_BIOME
|
||||||
|
);
|
||||||
|
Registry.register(
|
||||||
|
reg,
|
||||||
|
NETHER_WASTES_BIOME.getBCLBiomeKey(),
|
||||||
|
NETHER_WASTES_BIOME
|
||||||
|
);
|
||||||
|
return Registry.register(reg, BCLBiomeRegistry.EMPTY_BIOME.getBCLBiomeKey(), BCLBiomeRegistry.EMPTY_BIOME);
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ import net.minecraft.core.HolderGetter;
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.biome.BiomeSource;
|
import net.minecraft.world.level.biome.BiomeSource;
|
||||||
|
|
||||||
|
@Deprecated(forRemoval = true)
|
||||||
public interface BiomeSourceFromRegistry<T extends BiomeSource> {
|
public interface BiomeSourceFromRegistry<T extends BiomeSource> {
|
||||||
HolderGetter<Biome> getBiomeRegistry();
|
HolderGetter<Biome> getBiomeRegistry();
|
||||||
boolean didBiomeRegistryChange();
|
boolean didBiomeRegistryChange();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue