Make BiomeBuilder instance based
This commit is contained in:
parent
d279b6dfd0
commit
51882758b0
3 changed files with 43 additions and 26 deletions
|
@ -21,6 +21,7 @@ import org.betterx.bclib.recipes.CraftingRecipes;
|
|||
import org.betterx.bclib.registry.BaseBlockEntities;
|
||||
import org.betterx.bclib.registry.BaseRegistry;
|
||||
import org.betterx.bclib.registry.PresetsRegistry;
|
||||
import org.betterx.datagen.bclib.tests.TestStructure;
|
||||
import org.betterx.worlds.together.WorldsTogether;
|
||||
import org.betterx.worlds.together.util.Logger;
|
||||
import org.betterx.worlds.together.world.WorldConfig;
|
||||
|
@ -66,6 +67,9 @@ public class BCLib implements ModInitializer {
|
|||
CommandRegistry.register();
|
||||
BCLBlockTags.ensureStaticallyLoaded();
|
||||
PoiManager.registerAll();
|
||||
if (isDevEnvironment()) {
|
||||
TestStructure.registerBase();
|
||||
}
|
||||
|
||||
DataExchangeAPI.registerDescriptors(List.of(
|
||||
HelloClient.DESCRIPTOR,
|
||||
|
|
|
@ -129,8 +129,6 @@ public class BCLBiomeBuilder {
|
|||
private interface BuildCompletion extends Function<BootstapContext<Biome>, Biome> {
|
||||
}
|
||||
|
||||
|
||||
private static final BCLBiomeBuilder INSTANCE = new BCLBiomeBuilder();
|
||||
private static final SurfaceRules.ConditionSource SURFACE_NOISE = SurfaceRules.noiseCondition(
|
||||
Noises.SOUL_SAND_LAYER,
|
||||
-0.012
|
||||
|
@ -144,7 +142,7 @@ public class BCLBiomeBuilder {
|
|||
private MobSpawnSettings.Builder spawnSettings;
|
||||
private SurfaceRules.RuleSource surfaceRule;
|
||||
private Precipitation precipitation;
|
||||
private ResourceLocation biomeID;
|
||||
final private ResourceLocation biomeID;
|
||||
|
||||
|
||||
private final Set<TagKey<Biome>> tags = Sets.newHashSet();
|
||||
|
@ -164,6 +162,24 @@ public class BCLBiomeBuilder {
|
|||
private BiomeAPI.BiomeType biomeType;
|
||||
|
||||
|
||||
BCLBiomeBuilder(ResourceLocation biomeID) {
|
||||
this.biomeID = biomeID;
|
||||
this.precipitation = Precipitation.NONE;
|
||||
this.generationSettings = null;
|
||||
this.effectsBuilder = null;
|
||||
this.spawnSettings = null;
|
||||
this.temperature = 1.0F;
|
||||
this.fogDensity = 1.0F;
|
||||
this.edgeSize = 0;
|
||||
this.downfall = 1.0F;
|
||||
this.genChance = 1.0F;
|
||||
this.height = 0.1F;
|
||||
this.vertical = false;
|
||||
this.edge = null;
|
||||
this.parent = null;
|
||||
this.biomeType = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts new biome building process.
|
||||
*
|
||||
|
@ -173,26 +189,7 @@ public class BCLBiomeBuilder {
|
|||
public static BCLBiomeBuilder start(
|
||||
ResourceLocation biomeID
|
||||
) {
|
||||
INSTANCE.biomeID = biomeID;
|
||||
INSTANCE.precipitation = Precipitation.NONE;
|
||||
INSTANCE.generationSettings = null;
|
||||
INSTANCE.effectsBuilder = null;
|
||||
INSTANCE.spawnSettings = null;
|
||||
INSTANCE.temperature = 1.0F;
|
||||
INSTANCE.fogDensity = 1.0F;
|
||||
INSTANCE.edgeSize = 0;
|
||||
INSTANCE.downfall = 1.0F;
|
||||
INSTANCE.genChance = 1.0F;
|
||||
INSTANCE.height = 0.1F;
|
||||
INSTANCE.vertical = false;
|
||||
INSTANCE.edge = null;
|
||||
INSTANCE.parent = null;
|
||||
INSTANCE.carvers.clear();
|
||||
INSTANCE.parameters.clear();
|
||||
INSTANCE.tags.clear();
|
||||
INSTANCE.biomeType = null;
|
||||
INSTANCE.featureSupliers.clear();
|
||||
return INSTANCE;
|
||||
return new BCLBiomeBuilder(biomeID);
|
||||
}
|
||||
|
||||
public BCLBiomeBuilder addNetherClimateParamater(float temperature, float humidity) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.betterx.datagen.bclib.tests;
|
||||
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.util.BlocksHelper;
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
import org.betterx.worlds.together.tag.v3.TagManager;
|
||||
|
||||
|
@ -19,6 +20,7 @@ import net.minecraft.world.level.LevelHeightAccessor;
|
|||
import net.minecraft.world.level.StructureManager;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
|
@ -71,7 +73,17 @@ class TestStructurePiece extends StructurePiece {
|
|||
ChunkPos chunkPos,
|
||||
BlockPos blockPos
|
||||
) {
|
||||
|
||||
for (int x = boundingBox.minX(); x < boundingBox.maxX(); x++) {
|
||||
for (int y = boundingBox.minY(); y < boundingBox.maxY(); y++) {
|
||||
for (int z = boundingBox.minZ(); z < boundingBox.maxZ(); z++) {
|
||||
BlocksHelper.setWithoutUpdate(
|
||||
worldGenLevel,
|
||||
new BlockPos(x, y, z),
|
||||
Blocks.AMETHYST_BLOCK.defaultBlockState()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,8 +157,7 @@ public class TestStructure extends Structure {
|
|||
|
||||
public static void bootstrap(BootstapContext<Structure> bootstrapContext) {
|
||||
BCLib.LOGGER.info("Bootstrap Structure");
|
||||
Registry.register(BuiltInRegistries.STRUCTURE_PIECE, TestStructurePiece.KEY, TestStructurePiece.INSTANCE);
|
||||
Registry.register(BuiltInRegistries.STRUCTURE_TYPE, TYPE_KEY, TYPE);
|
||||
//registerBase();
|
||||
HolderSet<Biome> biomes = bootstrapContext.lookup(Registries.BIOME).getOrThrow(TEST_STRUCTURE_TAG);
|
||||
|
||||
bootstrapContext.register(KEY, new TestStructure(new Structure.StructureSettings(
|
||||
|
@ -156,4 +167,9 @@ public class TestStructure extends Structure {
|
|||
TerrainAdjustment.BEARD_THIN
|
||||
)));
|
||||
}
|
||||
|
||||
public static void registerBase() {
|
||||
Registry.register(BuiltInRegistries.STRUCTURE_PIECE, TestStructurePiece.KEY, TestStructurePiece.INSTANCE);
|
||||
Registry.register(BuiltInRegistries.STRUCTURE_TYPE, TYPE_KEY, TYPE);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue