Fixes to make BetterNether DataGen run
This commit is contained in:
parent
8626560681
commit
c75450b6c5
10 changed files with 102 additions and 85 deletions
|
@ -189,7 +189,7 @@ public class BCLibEndBiomeSource extends BCLBiomeSource implements BiomeSourceWi
|
|||
}
|
||||
if (endCenterBiomePicker.isEmpty()) {
|
||||
BCLib.LOGGER.warning("No Center Island Biomes found. Forcing use of vanilla center.");
|
||||
endCenterBiomePicker.addBiome(BCLBiomeRegistry.THE_END);
|
||||
endCenterBiomePicker.addBiome(BiomeAPI.THE_END);
|
||||
endCenterBiomePicker.rebuild();
|
||||
if (endCenterBiomePicker.isEmpty()) {
|
||||
BCLib.LOGGER.error("Unable to force vanilla central Island. Falling back to land Biomes...");
|
||||
|
|
|
@ -45,12 +45,13 @@ import com.google.common.collect.Lists;
|
|||
import com.google.common.collect.Sets;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BCLBiomeBuilder {
|
||||
private static final List<UnboundBCLBiome<?>> undoundBiomes = new LinkedList<>();
|
||||
static final ConcurrentLinkedQueue<UnboundBCLBiome<?>> UNBOUND_BIOMES = new ConcurrentLinkedQueue<>();
|
||||
|
||||
public static int calculateSkyColor(float temperature) {
|
||||
return OverworldBiomes.calculateSkyColor(temperature);
|
||||
|
@ -957,12 +958,12 @@ public class BCLBiomeBuilder {
|
|||
return builder.generationSettings(fixGenerationSettings(genBuilder.build())).build();
|
||||
}
|
||||
);
|
||||
undoundBiomes.add(unbound);
|
||||
UNBOUND_BIOMES.add(unbound);
|
||||
return unbound;
|
||||
}
|
||||
|
||||
public static void registerUnbound(BootstapContext<Biome> context) {
|
||||
undoundBiomes.forEach(u -> u.register(context));
|
||||
undoundBiomes.clear();
|
||||
UNBOUND_BIOMES.forEach(u -> u.register(context));
|
||||
UNBOUND_BIOMES.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.betterx.bclib.api.v2.levelgen.biomes;
|
||||
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.datagen.bclib.worldgen.VanillaBCLBiomesDataProvider;
|
||||
import org.betterx.worlds.together.WorldsTogether;
|
||||
import org.betterx.worlds.together.world.event.WorldBootstrap;
|
||||
|
||||
|
@ -43,59 +44,7 @@ public class BCLBiomeRegistry {
|
|||
* Have {@code Biomes.THE_VOID} as the reference biome.
|
||||
**/
|
||||
public static final BCLBiome EMPTY_BIOME = new BCLBiome(Biomes.THE_VOID.location());
|
||||
|
||||
public static final BCLBiome THE_END = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.THE_END,
|
||||
InternalBiomeAPI.OTHER_END_CENTER
|
||||
);
|
||||
|
||||
public static final BCLBiome NETHER_WASTES_BIOME = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.NETHER_WASTES,
|
||||
InternalBiomeAPI.OTHER_NETHER
|
||||
);
|
||||
|
||||
public static final BCLBiome CRIMSON_FOREST_BIOME = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.CRIMSON_FOREST,
|
||||
InternalBiomeAPI.OTHER_NETHER
|
||||
);
|
||||
|
||||
public static final BCLBiome WARPED_FOREST_BIOME = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.WARPED_FOREST,
|
||||
InternalBiomeAPI.OTHER_NETHER
|
||||
);
|
||||
|
||||
public static final BCLBiome SOUL_SAND_VALLEY_BIOME = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.SOUL_SAND_VALLEY,
|
||||
InternalBiomeAPI.OTHER_NETHER
|
||||
);
|
||||
public static final BCLBiome BASALT_DELTAS_BIOME = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.BASALT_DELTAS,
|
||||
InternalBiomeAPI.OTHER_NETHER
|
||||
);
|
||||
|
||||
public static final BCLBiome END_MIDLANDS = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.END_MIDLANDS,
|
||||
0.5F,
|
||||
InternalBiomeAPI.OTHER_END_LAND
|
||||
);
|
||||
|
||||
public static final BCLBiome END_HIGHLANDS = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.END_HIGHLANDS,
|
||||
END_MIDLANDS,
|
||||
8,
|
||||
0.5F,
|
||||
InternalBiomeAPI.OTHER_END_LAND
|
||||
);
|
||||
|
||||
public static final BCLBiome END_BARRENS = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.END_BARRENS,
|
||||
InternalBiomeAPI.OTHER_END_BARRENS
|
||||
);
|
||||
|
||||
public static final BCLBiome SMALL_END_ISLANDS = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.SMALL_END_ISLANDS,
|
||||
InternalBiomeAPI.OTHER_END_VOID
|
||||
);
|
||||
private static boolean didCreate = false;
|
||||
|
||||
public static boolean isEmptyBiome(ResourceLocation l) {
|
||||
return l == null || Biomes.THE_VOID.location().equals(l);
|
||||
|
@ -201,7 +150,7 @@ public class BCLBiomeRegistry {
|
|||
if (WorldBootstrap.getLastRegistryAccess() == null) return null;
|
||||
return WorldBootstrap.getLastRegistryAccess().registry(BCL_BIOMES_REGISTRY).orElse(null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Stream<ResourceKey<BCLBiome>> getAll(BiomeAPI.BiomeType dim) {
|
||||
Set<ResourceKey<BCLBiome>> result = new HashSet<>();
|
||||
|
@ -239,4 +188,14 @@ public class BCLBiomeRegistry {
|
|||
public static void ensureStaticallyLoaded() {
|
||||
|
||||
}
|
||||
|
||||
public static void prepareForDatagen() {
|
||||
if (didCreate) return;
|
||||
didCreate = true;
|
||||
|
||||
BUILTIN_BCL_BIOMES = BuiltInRegistries.registerSimple(
|
||||
BCL_BIOMES_REGISTRY,
|
||||
VanillaBCLBiomesDataProvider::bootstrap
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.world.level.Level;
|
|||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
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.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
|
@ -56,6 +57,51 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
public class BiomeAPI {
|
||||
|
||||
public static final BCLBiome THE_END = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.THE_END,
|
||||
InternalBiomeAPI.OTHER_END_CENTER
|
||||
);
|
||||
public static final BCLBiome NETHER_WASTES_BIOME = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.NETHER_WASTES,
|
||||
InternalBiomeAPI.OTHER_NETHER
|
||||
);
|
||||
public static final BCLBiome CRIMSON_FOREST_BIOME = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.CRIMSON_FOREST,
|
||||
InternalBiomeAPI.OTHER_NETHER
|
||||
);
|
||||
public static final BCLBiome WARPED_FOREST_BIOME = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.WARPED_FOREST,
|
||||
InternalBiomeAPI.OTHER_NETHER
|
||||
);
|
||||
public static final BCLBiome SOUL_SAND_VALLEY_BIOME = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.SOUL_SAND_VALLEY,
|
||||
InternalBiomeAPI.OTHER_NETHER
|
||||
);
|
||||
public static final BCLBiome BASALT_DELTAS_BIOME = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.BASALT_DELTAS,
|
||||
InternalBiomeAPI.OTHER_NETHER
|
||||
);
|
||||
public static final BCLBiome END_MIDLANDS = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.END_MIDLANDS,
|
||||
0.5F,
|
||||
InternalBiomeAPI.OTHER_END_LAND
|
||||
);
|
||||
public static final BCLBiome END_HIGHLANDS = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.END_HIGHLANDS,
|
||||
END_MIDLANDS,
|
||||
8,
|
||||
0.5F,
|
||||
InternalBiomeAPI.OTHER_END_LAND
|
||||
);
|
||||
public static final BCLBiome END_BARRENS = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.END_BARRENS,
|
||||
InternalBiomeAPI.OTHER_END_BARRENS
|
||||
);
|
||||
public static final BCLBiome SMALL_END_ISLANDS = InternalBiomeAPI.wrapBiome(
|
||||
Biomes.SMALL_END_ISLANDS,
|
||||
InternalBiomeAPI.OTHER_END_VOID
|
||||
);
|
||||
|
||||
/**
|
||||
* Register {@link BCLBiome} instance and its {@link Biome} if necessary.
|
||||
*
|
||||
|
|
|
@ -40,6 +40,7 @@ class UnboundBCLBiome<T extends BCLBiome> extends BCLBiomeContainer<T> {
|
|||
BiomeAPI.registerBuiltinBiomeAndOverrideIntendedDimension(bootstrapContext, biome, dim);
|
||||
}
|
||||
|
||||
BCLBiomeBuilder.UNBOUND_BIOMES.remove(this);
|
||||
registered = new BCLBiomeContainer<>(this.biome);
|
||||
return registered;
|
||||
}
|
||||
|
|
|
@ -19,18 +19,25 @@ import java.util.Optional;
|
|||
|
||||
public class BCLConfigureFeature<F extends Feature<FC>, FC extends FeatureConfiguration> {
|
||||
public static class Unregistered<F extends Feature<FC>, FC extends FeatureConfiguration> extends BCLConfigureFeature<F, FC> {
|
||||
private BCLConfigureFeature<F, FC> registered;
|
||||
|
||||
Unregistered(ResourceLocation id, Holder<ConfiguredFeature<FC, F>> configuredFeature) {
|
||||
super(id, configuredFeature, false);
|
||||
registered = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BCLConfigureFeature<F, FC> register(BootstapContext<ConfiguredFeature<?, ?>> bootstrapContext) {
|
||||
if (registered != null) return registered;
|
||||
|
||||
Holder<ConfiguredFeature<FC, F>> holder = BCLFeatureBuilder.register(
|
||||
bootstrapContext,
|
||||
id,
|
||||
configuredFeature.value()
|
||||
);
|
||||
return new BCLConfigureFeature<>(id, holder, true);
|
||||
BCLFeatureBuilder.UNBOUND_FEATURES.remove(this);
|
||||
registered = new BCLConfigureFeature<>(id, holder, true);
|
||||
return registered;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,21 +19,27 @@ import org.jetbrains.annotations.ApiStatus;
|
|||
|
||||
public class BCLFeature<F extends Feature<FC>, FC extends FeatureConfiguration> {
|
||||
public static class Unregistered<F extends Feature<FC>, FC extends FeatureConfiguration> extends BCLFeature<F, FC> {
|
||||
private BCLFeature<F, FC> registered;
|
||||
|
||||
Unregistered(
|
||||
BCLConfigureFeature<F, FC> configuredFeature,
|
||||
Holder<PlacedFeature> placed,
|
||||
GenerationStep.Decoration decoration
|
||||
) {
|
||||
super(configuredFeature, placed, decoration);
|
||||
registered = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BCLFeature<F, FC> register(BootstapContext<PlacedFeature> bootstrapContext) {
|
||||
if (registered != null) return registered;
|
||||
Holder<PlacedFeature> holder = BCLPlacedFeatureBuilder.register(
|
||||
bootstrapContext,
|
||||
getPlacedFeature()
|
||||
);
|
||||
return new BCLFeature<>(configuredFeature, holder, decoration);
|
||||
BCLPlacedFeatureBuilder.UNBOUND_FEATURES.remove(this);
|
||||
registered = new BCLFeature<>(configuredFeature, holder, decoration);
|
||||
return registered;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ import java.util.Collection;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
@ -59,7 +60,7 @@ public abstract class BCLFeatureBuilder<F extends Feature<FC>, FC extends Featur
|
|||
B create(ResourceLocation id, Holder<ConfiguredFeature<FC, F>> configuredFeature);
|
||||
}
|
||||
|
||||
private static List<BCLConfigureFeature.Unregistered<?, ?>> UNBOUND_FEATURES = new LinkedList<>();
|
||||
static ConcurrentLinkedQueue<BCLConfigureFeature.Unregistered<?, ?>> UNBOUND_FEATURES = new ConcurrentLinkedQueue<>();
|
||||
|
||||
/**
|
||||
* Starts a new {@link BCLFeature} builder.
|
||||
|
|
|
@ -13,15 +13,15 @@ import net.minecraft.world.level.levelgen.feature.Feature;
|
|||
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
public class BCLPlacedFeatureBuilder<F extends Feature<FC>, FC extends FeatureConfiguration> extends CommonPlacedFeatureBuilder<F, FC, BCLPlacedFeatureBuilder<F, FC>> {
|
||||
private final ResourceLocation featureID;
|
||||
private GenerationStep.Decoration decoration = GenerationStep.Decoration.VEGETAL_DECORATION;
|
||||
private final BCLConfigureFeature<F, FC> cFeature;
|
||||
|
||||
private static final List<BCLFeature.Unregistered> UNBOUND_FEATURES = new LinkedList<>();
|
||||
static final ConcurrentLinkedQueue<BCLFeature.Unregistered> UNBOUND_FEATURES = new ConcurrentLinkedQueue<>();
|
||||
|
||||
private BCLPlacedFeatureBuilder(
|
||||
ResourceLocation featureID,
|
||||
|
|
|
@ -2,19 +2,15 @@ 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.BiomeAPI;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
|
||||
public class VanillaBCLBiomesDataProvider {
|
||||
private static boolean didBootstrap = false;
|
||||
|
||||
public static void create() {
|
||||
BCLBiomeRegistry.BUILTIN_BCL_BIOMES = BuiltInRegistries.registerSimple(
|
||||
BCLBiomeRegistry.BCL_BIOMES_REGISTRY,
|
||||
VanillaBCLBiomesDataProvider::bootstrap
|
||||
);
|
||||
|
||||
BCLBiomeRegistry.prepareForDatagen();
|
||||
bootstrap(BCLBiomeRegistry.BUILTIN_BCL_BIOMES);
|
||||
}
|
||||
|
||||
|
@ -23,35 +19,35 @@ public class VanillaBCLBiomesDataProvider {
|
|||
didBootstrap = true;
|
||||
|
||||
|
||||
Registry.register(reg, BCLBiomeRegistry.SMALL_END_ISLANDS.getBCLBiomeKey(), BCLBiomeRegistry.SMALL_END_ISLANDS);
|
||||
Registry.register(reg, BCLBiomeRegistry.END_BARRENS.getBCLBiomeKey(), BCLBiomeRegistry.END_BARRENS);
|
||||
Registry.register(reg, BCLBiomeRegistry.END_HIGHLANDS.getBCLBiomeKey(), BCLBiomeRegistry.END_HIGHLANDS);
|
||||
Registry.register(reg, BCLBiomeRegistry.END_MIDLANDS.getBCLBiomeKey(), BCLBiomeRegistry.END_MIDLANDS);
|
||||
Registry.register(reg, BCLBiomeRegistry.THE_END.getBCLBiomeKey(), BCLBiomeRegistry.THE_END);
|
||||
Registry.register(reg, BiomeAPI.SMALL_END_ISLANDS.getBCLBiomeKey(), BiomeAPI.SMALL_END_ISLANDS);
|
||||
Registry.register(reg, BiomeAPI.END_BARRENS.getBCLBiomeKey(), BiomeAPI.END_BARRENS);
|
||||
Registry.register(reg, BiomeAPI.END_HIGHLANDS.getBCLBiomeKey(), BiomeAPI.END_HIGHLANDS);
|
||||
Registry.register(reg, BiomeAPI.END_MIDLANDS.getBCLBiomeKey(), BiomeAPI.END_MIDLANDS);
|
||||
Registry.register(reg, BiomeAPI.THE_END.getBCLBiomeKey(), BiomeAPI.THE_END);
|
||||
Registry.register(
|
||||
reg,
|
||||
BCLBiomeRegistry.BASALT_DELTAS_BIOME.getBCLBiomeKey(),
|
||||
BCLBiomeRegistry.BASALT_DELTAS_BIOME
|
||||
BiomeAPI.BASALT_DELTAS_BIOME.getBCLBiomeKey(),
|
||||
BiomeAPI.BASALT_DELTAS_BIOME
|
||||
);
|
||||
Registry.register(
|
||||
reg,
|
||||
BCLBiomeRegistry.SOUL_SAND_VALLEY_BIOME.getBCLBiomeKey(),
|
||||
BCLBiomeRegistry.SOUL_SAND_VALLEY_BIOME
|
||||
BiomeAPI.SOUL_SAND_VALLEY_BIOME.getBCLBiomeKey(),
|
||||
BiomeAPI.SOUL_SAND_VALLEY_BIOME
|
||||
);
|
||||
Registry.register(
|
||||
reg,
|
||||
BCLBiomeRegistry.WARPED_FOREST_BIOME.getBCLBiomeKey(),
|
||||
BCLBiomeRegistry.WARPED_FOREST_BIOME
|
||||
BiomeAPI.WARPED_FOREST_BIOME.getBCLBiomeKey(),
|
||||
BiomeAPI.WARPED_FOREST_BIOME
|
||||
);
|
||||
Registry.register(
|
||||
reg,
|
||||
BCLBiomeRegistry.CRIMSON_FOREST_BIOME.getBCLBiomeKey(),
|
||||
BCLBiomeRegistry.CRIMSON_FOREST_BIOME
|
||||
BiomeAPI.CRIMSON_FOREST_BIOME.getBCLBiomeKey(),
|
||||
BiomeAPI.CRIMSON_FOREST_BIOME
|
||||
);
|
||||
Registry.register(
|
||||
reg,
|
||||
BCLBiomeRegistry.NETHER_WASTES_BIOME.getBCLBiomeKey(),
|
||||
BCLBiomeRegistry.NETHER_WASTES_BIOME
|
||||
BiomeAPI.NETHER_WASTES_BIOME.getBCLBiomeKey(),
|
||||
BiomeAPI.NETHER_WASTES_BIOME
|
||||
);
|
||||
return Registry.register(reg, BCLBiomeRegistry.EMPTY_BIOME.getBCLBiomeKey(), BCLBiomeRegistry.EMPTY_BIOME);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue