[Feature] New End-Village with some special loot

This commit is contained in:
Frank 2023-06-07 09:01:32 +02:00
parent d588240c7f
commit bc75a07d75
22 changed files with 185 additions and 4 deletions

View file

@ -5,6 +5,7 @@ import org.betterx.bclib.api.v2.levelgen.structures.BCLStructureBuilder;
import org.betterx.betterend.BetterEnd;
import org.betterx.betterend.world.structures.features.*;
import org.betterx.betterend.world.structures.piece.*;
import org.betterx.betterend.world.structures.village.VillagePools;
import org.betterx.worlds.together.tag.v3.TagManager;
import net.minecraft.core.Holder;
@ -13,7 +14,12 @@ import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.levelgen.VerticalAnchor;
import net.minecraft.world.level.levelgen.heightproviders.ConstantHeight;
import net.minecraft.world.level.levelgen.structure.TerrainAdjustment;
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceType;
import net.minecraft.world.level.levelgen.structure.structures.JigsawStructure;
public class EndStructures {
public static final StructurePieceType VOXEL_PIECE = register("voxel", VoxelPiece::new);
@ -65,6 +71,17 @@ public class EndStructures {
.randomPlacement(16, 8)
.build();
public static final BCLStructure<JigsawStructure> END_VILLAGE = BCLStructureBuilder
.jigsaw(BetterEnd.makeID("end_village"))
.startPool(VillagePools.START)
.adjustment(TerrainAdjustment.BEARD_THIN)
.projectStartToHeightmap(Heightmap.Types.WORLD_SURFACE_WG)
.maxDepth(6)
.startHeight(ConstantHeight.of(VerticalAnchor.absolute(0)))
.step(Decoration.SURFACE_STRUCTURES)
.randomPlacement(34, 8)
.build();
public static void register() {
}

View file

@ -5,6 +5,7 @@ import org.betterx.bclib.api.v2.levelgen.surface.SurfaceRuleBuilder;
import org.betterx.bclib.interfaces.SurfaceMaterialProvider;
import org.betterx.betterend.registry.EndBlocks;
import org.betterx.betterend.registry.EndSounds;
import org.betterx.betterend.registry.EndStructures;
import org.betterx.betterend.world.biome.EndBiome;
import net.minecraft.core.particles.ParticleTypes;
@ -31,6 +32,7 @@ public class DustWastelandsBiome extends EndBiome.Config {
.loop(EndSounds.AMBIENT_DUST_WASTELANDS)
.music(EndSounds.MUSIC_OPENSPACE)
.structure(BiomeTags.HAS_END_CITY)
.structure(EndStructures.END_VILLAGE.biomeTag)
.spawn(EntityType.ENDERMAN, 50, 1, 2);
}

View file

@ -0,0 +1,138 @@
package org.betterx.betterend.world.structures.village;
import org.betterx.bclib.api.v2.levelgen.structures.StructurePools;
import org.betterx.betterend.BetterEnd;
import com.mojang.datafixers.util.Pair;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderGetter;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.data.worldgen.Pools;
import net.minecraft.data.worldgen.ProcessorLists;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.minecraft.world.level.levelgen.structure.pools.StructurePoolElement;
import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorList;
import com.google.common.collect.ImmutableList;
public class VillagePools {
public static ResourceKey<StructureTemplatePool> TERMINATORS_KEY = StructurePools
.createKey(BetterEnd.makeID("village/terminators"));
public static ResourceKey<StructureTemplatePool> START = StructurePools
.createKey(BetterEnd.makeID("village/center_piece"));
public static ResourceKey<StructureTemplatePool> HOUSES_KEY = StructurePools
.createKey(BetterEnd.makeID("village/houses"));
public static ResourceKey<StructureTemplatePool> STREET_KEY = StructurePools
.createKey(BetterEnd.makeID("village/streets"));
public static ResourceKey<StructureTemplatePool> STREET_DECO_KEY = StructurePools
.createKey(BetterEnd.makeID("village/street_decorations"));
public static ResourceKey<StructureTemplatePool> DECORATIONS_KEY = StructurePools
.createKey(BetterEnd.makeID("village/decorations"));
public static void bootstrap(BootstapContext<StructureTemplatePool> ctx) {
final HolderGetter<StructureProcessorList> processorGetter = ctx.lookup(Registries.PROCESSOR_LIST);
final HolderGetter<PlacedFeature> featureGetter = ctx.lookup(Registries.PLACED_FEATURE);
final HolderGetter<StructureTemplatePool> poolGetter = ctx.lookup(Registries.TEMPLATE_POOL);
HolderGetter<Biome> biomeGetter = ctx.lookup(Registries.BIOME);
final Holder.Reference<StructureTemplatePool> emptyPool = poolGetter.getOrThrow(Pools.EMPTY);
final Holder.Reference<StructureTemplatePool> terminatorPool = poolGetter.getOrThrow(VillagePools.TERMINATORS_KEY);
final Holder.Reference<StructureProcessorList> 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
)),
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
)),
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
)),
StructureTemplatePool.Projection.RIGID
));
ctx.register(VillagePools.STREET_KEY, new StructureTemplatePool(
terminatorPool,
ImmutableList.of(Pair.of(
StructurePools.single(BetterEnd.makeID("village/streets/street_01"), emptyProcessor),
6
), Pair.of(
StructurePools.single(BetterEnd.makeID("village/streets/street_02"), emptyProcessor),
4
), Pair.of(
StructurePools.single(BetterEnd.makeID("village/streets/curve_01"), emptyProcessor),
3
), Pair.of(
StructurePools.single(BetterEnd.makeID("village/streets/t_crossing_01"), emptyProcessor),
1
), Pair.of(
StructurePools.single(BetterEnd.makeID("village/streets/t_crossing_02"), emptyProcessor),
2
)),
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
)
),
StructureTemplatePool.Projection.RIGID
));
ctx.register(VillagePools.DECORATIONS_KEY, new StructureTemplatePool(
terminatorPool,
ImmutableList.of(),
StructureTemplatePool.Projection.RIGID
));
}
}

View file

@ -4,6 +4,7 @@ import org.betterx.datagen.betterend.advancement.EndAdvancementDataProvider;
import org.betterx.datagen.betterend.recipes.EndRecipeDataProvider;
import org.betterx.datagen.betterend.worldgen.EndBiomesDataProvider;
import org.betterx.datagen.betterend.worldgen.EndRegistriesDataProvider;
import org.betterx.datagen.betterend.worldgen.TemplatePoolDataProvider;
import net.minecraft.core.RegistrySetBuilder;
import net.minecraft.core.registries.Registries;
@ -16,6 +17,7 @@ public class BetterEndDatagen implements DataGeneratorEntrypoint {
public void onInitializeDataGenerator(FabricDataGenerator dataGenerator) {
EndBiomesDataProvider.ensureStaticallyLoaded();
EndRecipeDataProvider.buildRecipes();
TemplatePoolDataProvider.buildStructures();
final FabricDataGenerator.Pack pack = dataGenerator.createPack();
pack.addProvider(EndBiomesDataProvider::new);
@ -27,8 +29,10 @@ public class BetterEndDatagen implements DataGeneratorEntrypoint {
pack.addProvider(EndItemTagDataProvider::new);
}
@Override
public void buildRegistry(RegistrySetBuilder registryBuilder) {
EndBiomesDataProvider.ensureStaticallyLoaded();
EndRegistrySupplier.INSTANCE.bootstrapRegistries(registryBuilder);
registryBuilder.add(Registries.BIOME, EndBiomesDataProvider::bootstrap);
}

View file

@ -4,10 +4,7 @@ import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiomeRegistry;
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeData;
import org.betterx.bclib.api.v3.datagen.RegistrySupplier;
import org.betterx.betterend.BetterEnd;
import org.betterx.datagen.betterend.worldgen.ConfiguredFeatureDataProvider;
import org.betterx.datagen.betterend.worldgen.EndBiomesDataProvider;
import org.betterx.datagen.betterend.worldgen.PlacedFeatureDataProvider;
import org.betterx.datagen.betterend.worldgen.StructureDataProvider;
import org.betterx.datagen.betterend.worldgen.*;
import org.betterx.worlds.together.surfaceRules.AssignedSurfaceRule;
import org.betterx.worlds.together.surfaceRules.SurfaceRuleRegistry;
@ -17,6 +14,7 @@ import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.minecraft.world.level.levelgen.structure.Structure;
import net.minecraft.world.level.levelgen.structure.StructureSet;
import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;
import java.util.List;
import org.jetbrains.annotations.Nullable;
@ -54,6 +52,11 @@ public class EndRegistrySupplier extends RegistrySupplier {
PlacedFeature.DIRECT_CODEC,
PlacedFeatureDataProvider::bootstrap
),
new RegistryInfo<>(
Registries.TEMPLATE_POOL,
StructureTemplatePool.DIRECT_CODEC,
TemplatePoolDataProvider::bootstrap
),
new RegistryInfo<>(
Registries.BIOME,
Biome.DIRECT_CODEC,

View file

@ -0,0 +1,17 @@
package org.betterx.datagen.betterend.worldgen;
import org.betterx.betterend.world.structures.village.VillagePools;
import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;
public class TemplatePoolDataProvider {
public static void buildStructures() {
}
public static void bootstrap(BootstapContext<StructureTemplatePool> ctx) {
VillagePools.bootstrap(ctx);
}
}