diff --git a/src/main/java/org/betterx/betterend/registry/EndProcessors.java b/src/main/java/org/betterx/betterend/registry/EndProcessors.java index a26ccece..4df24189 100644 --- a/src/main/java/org/betterx/betterend/registry/EndProcessors.java +++ b/src/main/java/org/betterx/betterend/registry/EndProcessors.java @@ -13,4 +13,7 @@ public class EndProcessors { ProcessorHelper.createKey(BetterEnd.makeID("crack_20_percent")); public static final ResourceKey CRACK_AND_WEATHER = ProcessorHelper.createKey(BetterEnd.makeID("crack_and_weather")); + + public static final ResourceKey END_STREET = + ProcessorHelper.createKey(BetterEnd.makeID("end_street")); } diff --git a/src/main/java/org/betterx/betterend/registry/EndStructures.java b/src/main/java/org/betterx/betterend/registry/EndStructures.java index 45559b02..a18d40f5 100644 --- a/src/main/java/org/betterx/betterend/registry/EndStructures.java +++ b/src/main/java/org/betterx/betterend/registry/EndStructures.java @@ -77,7 +77,7 @@ public class EndStructures { .adjustment(TerrainAdjustment.BEARD_THIN) .projectStartToHeightmap(Heightmap.Types.WORLD_SURFACE_WG) .maxDepth(6) - .startHeight(ConstantHeight.of(VerticalAnchor.absolute(0))) + .startHeight(ConstantHeight.of(VerticalAnchor.absolute(20))) .step(Decoration.SURFACE_STRUCTURES) .randomPlacement(34, 8) .build(); diff --git a/src/main/java/org/betterx/betterend/world/structures/village/VillagePools.java b/src/main/java/org/betterx/betterend/world/structures/village/VillagePools.java index 36bb3845..001956dc 100644 --- a/src/main/java/org/betterx/betterend/world/structures/village/VillagePools.java +++ b/src/main/java/org/betterx/betterend/world/structures/village/VillagePools.java @@ -1,5 +1,6 @@ package org.betterx.betterend.world.structures.village; +import org.betterx.bclib.api.v2.levelgen.structures.SingleEndPoolElement; import org.betterx.bclib.api.v2.levelgen.structures.StructurePools; import org.betterx.betterend.BetterEnd; import org.betterx.betterend.registry.EndProcessors; @@ -20,6 +21,8 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProc import com.google.common.collect.ImmutableList; +import java.util.function.Function; + public class VillagePools { public static ResourceKey TERMINATORS_KEY = StructurePools .createKey(BetterEnd.makeID("village/terminators")); @@ -34,6 +37,14 @@ public class VillagePools { public static ResourceKey DECORATIONS_KEY = StructurePools .createKey(BetterEnd.makeID("village/decorations")); + public static Pair, Integer> single( + String name, + Holder processor, + int weight + ) { + return Pair.of(SingleEndPoolElement.end(BetterEnd.makeID(name), processor), weight); + } + public static void bootstrap(BootstapContext ctx) { final HolderGetter processorGetter = ctx.lookup(Registries.PROCESSOR_LIST); final HolderGetter featureGetter = ctx.lookup(Registries.PLACED_FEATURE); @@ -43,124 +54,74 @@ public class VillagePools { final Holder.Reference emptyPool = poolGetter.getOrThrow(Pools.EMPTY); final Holder.Reference terminatorPool = poolGetter.getOrThrow(VillagePools.TERMINATORS_KEY); - Holder.Reference mossify = processorGetter.getOrThrow(EndProcessors.WEATHERED_10_PERCENT); + Holder.Reference mossifyProcessor = processorGetter.getOrThrow(EndProcessors.WEATHERED_10_PERCENT); Holder.Reference crack = processorGetter.getOrThrow(EndProcessors.CRACK_20_PERCENT); - Holder.Reference crackAndWeather = processorGetter.getOrThrow(EndProcessors.CRACK_AND_WEATHER); + Holder.Reference endStreetProcessor = processorGetter.getOrThrow(EndProcessors.END_STREET); final Holder.Reference emptyProcessor = processorGetter.getOrThrow(ProcessorLists.EMPTY); ctx.register(VillagePools.TERMINATORS_KEY, new StructureTemplatePool( emptyPool, - ImmutableList.of(Pair.of( - StructurePools.single( - BetterEnd.makeID("village/terminators/stree_terminator_01"), - emptyProcessor - ), - 1 - )), + ImmutableList.of( + single("village/terminators/stree_terminator_01", emptyProcessor, 1) + ), StructureTemplatePool.Projection.TERRAIN_MATCHING )); ctx.register(VillagePools.START, new StructureTemplatePool( terminatorPool, - ImmutableList.of(Pair.of( - StructurePools.single(BetterEnd.makeID("village/center/light_pyramid_01"), emptyProcessor), - 1 - )), + ImmutableList.of( + single("village/center/light_pyramid_01", emptyProcessor, 1) + ), StructureTemplatePool.Projection.RIGID )); ctx.register(VillagePools.HOUSES_KEY, new StructureTemplatePool( terminatorPool, - ImmutableList.of(Pair.of(StructurePoolElement.empty(), 5), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/small_house_01"), emptyProcessor), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/small_house_02"), emptyProcessor), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/small_house_03"), emptyProcessor), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/small_house_04"), emptyProcessor), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/small_house_05"), emptyProcessor), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/small_house_06"), emptyProcessor), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/small_house_07"), emptyProcessor), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/small_house_08"), emptyProcessor), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/small_house_09"), emptyProcessor), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/small_house_10"), emptyProcessor), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/small_house_11"), emptyProcessor), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/small_house_12"), emptyProcessor), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/small_house_13"), emptyProcessor), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/small_house_14"), emptyProcessor), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/small_house_15"), emptyProcessor), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/small_house_16"), emptyProcessor), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/houses/animal_pen_01"), emptyProcessor), - 1 - )), + ImmutableList.of( + Pair.of(StructurePoolElement.empty(), 5), + single("village/houses/small_house_01", emptyProcessor, 2), + single("village/houses/small_house_02", emptyProcessor, 2), + single("village/houses/small_house_03", emptyProcessor, 2), + single("village/houses/small_house_04", emptyProcessor, 2), + single("village/houses/small_house_05", emptyProcessor, 2), + single("village/houses/small_house_06", emptyProcessor, 2), + single("village/houses/small_house_07", emptyProcessor, 2), + single("village/houses/small_house_08", emptyProcessor, 2), + single("village/houses/small_house_09", emptyProcessor, 2), + single("village/houses/small_house_10", emptyProcessor, 2), + single("village/houses/small_house_11", emptyProcessor, 2), + single("village/houses/small_house_12", emptyProcessor, 2), + single("village/houses/small_house_13", emptyProcessor, 2), + single("village/houses/small_house_14", emptyProcessor, 2), + single("village/houses/small_house_15", emptyProcessor, 2), + single("village/houses/small_house_16", emptyProcessor, 2), + single("village/houses/small_house_17", emptyProcessor, 2), + single("village/houses/animal_pen_01", emptyProcessor, 1), + single("village/decoration/stable_01", crack, 1), + single("village/decoration/pond_01", mossifyProcessor, 3) + ), StructureTemplatePool.Projection.RIGID )); ctx.register(VillagePools.STREET_KEY, new StructureTemplatePool( terminatorPool, - ImmutableList.of(Pair.of( - StructurePools.single(BetterEnd.makeID("village/streets/street_01"), crackAndWeather), - 6 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/streets/street_02"), crackAndWeather), - 4 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/streets/curve_01"), crackAndWeather), - 3 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/streets/t_crossing_01"), crackAndWeather), - 1 - ), Pair.of( - StructurePools.single(BetterEnd.makeID("village/streets/t_crossing_02"), crackAndWeather), - 2 - )), + ImmutableList.of( + single("village/streets/street_01", endStreetProcessor, 6), + single("village/streets/street_02", endStreetProcessor, 5), + single("village/streets/street_03", endStreetProcessor, 7), + single("village/streets/curve_01", endStreetProcessor, 10), + single("village/streets/curve_02", endStreetProcessor, 12), + single("village/streets/t_crossing_01", endStreetProcessor, 4), + single("village/streets/t_crossing_02", endStreetProcessor, 5), + single("village/streets/respawn_crossing_01", endStreetProcessor, 5), + single("village/streets/respawn_crossing_02", endStreetProcessor, 5), + single("village/decoration/fountain_01", endStreetProcessor, 4) + ), StructureTemplatePool.Projection.TERRAIN_MATCHING )); ctx.register(VillagePools.STREET_DECO_KEY, new StructureTemplatePool( terminatorPool, ImmutableList.of( Pair.of(StructurePoolElement.empty(), 5), - Pair.of( - StructurePools.single( - BetterEnd.makeID("village/street_decoration/lamp_02"), - emptyProcessor - ), - 2 - ), - Pair.of( - StructurePools.single( - BetterEnd.makeID("village/street_decoration/lamp_05"), - emptyProcessor - ), - 1 - ) + single("village/street_decoration/lamp_02", emptyProcessor, 2), + single("village/street_decoration/lamp_05", emptyProcessor, 1) ), StructureTemplatePool.Projection.RIGID )); diff --git a/src/main/java/org/betterx/datagen/betterend/worldgen/ProcessorsDataProvider.java b/src/main/java/org/betterx/datagen/betterend/worldgen/ProcessorsDataProvider.java index 45357fe2..a7a8e682 100644 --- a/src/main/java/org/betterx/datagen/betterend/worldgen/ProcessorsDataProvider.java +++ b/src/main/java/org/betterx/datagen/betterend/worldgen/ProcessorsDataProvider.java @@ -2,6 +2,7 @@ package org.betterx.datagen.betterend.worldgen; import org.betterx.bclib.api.v3.datagen.ProcessorHelper; import org.betterx.bclib.complexmaterials.set.stone.StoneSlots; +import org.betterx.bclib.complexmaterials.set.wood.WoodSlots; import org.betterx.betterend.registry.EndBlocks; import org.betterx.betterend.registry.EndProcessors; @@ -50,5 +51,39 @@ public class ProcessorsDataProvider { ) ))) ); + + ProcessorHelper.register( + bootstapContext, + EndProcessors.END_STREET, + ImmutableList.of(new RuleProcessor(ImmutableList.of( + + new ProcessorRule( + new BlockMatchTest(Blocks.END_STONE_BRICKS), + new BlockMatchTest(Blocks.WATER), + EndBlocks.PYTHADENDRON.getBlock(WoodSlots.PLANKS).defaultBlockState() + ), + new ProcessorRule( + new BlockMatchTest(EndBlocks.ENDSTONE_DUST), + new BlockMatchTest(Blocks.WATER), + Blocks.WATER.defaultBlockState() + ), + new ProcessorRule( + new RandomBlockMatchTest(Blocks.END_STONE_BRICKS, 0.03f), + AlwaysTrueTest.INSTANCE, + EndBlocks.SHADOW_GRASS_PATH.defaultBlockState() + ), + new ProcessorRule( + new RandomBlockMatchTest(Blocks.END_STONE_BRICKS, 0.2f), + AlwaysTrueTest.INSTANCE, + EndBlocks.END_STONE_BRICK_VARIATIONS.getBlock(StoneSlots.CRACKED).defaultBlockState() + ), + new ProcessorRule( + new RandomBlockMatchTest(Blocks.END_STONE_BRICKS, 0.1f), + AlwaysTrueTest.INSTANCE, + EndBlocks.END_STONE_BRICK_VARIATIONS.getBlock(StoneSlots.WEATHERED).defaultBlockState() + ) + ))) + ); + } }