Structures.java

net.minecraft.data.worldgen.Structures

信息

  • 全限定名:net.minecraft.data.worldgen.Structures
  • 类型:public class
  • 包:net.minecraft.data.worldgen
  • 源码路径:src/main/java/net/minecraft/data/worldgen/Structures.java
  • 起始行号:L47
  • 职责:

    TODO

字段/常量

内部类/嵌套类型

构造器

方法

下面的方法块按源码顺序生成。

public static void bootstrap(BootstrapContext<Structure> context) @ L48

  • 方法名:bootstrap
  • 源码定位:L48
  • 返回类型:void
  • 修饰符:public static

参数:

  • context: BootstrapContext

说明:

TODO

代码

public class Structures {
    public static void bootstrap(BootstrapContext<Structure> context) {
        HolderGetter<Biome> biomes = context.lookup(Registries.BIOME);
        HolderGetter<StructureTemplatePool> templates = context.lookup(Registries.TEMPLATE_POOL);
        context.register(
            BuiltinStructures.PILLAGER_OUTPOST,
            new JigsawStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_PILLAGER_OUTPOST))
                    .spawnOverrides(
                        Map.of(
                            MobCategory.MONSTER,
                            new StructureSpawnOverride(
                                StructureSpawnOverride.BoundingBoxType.STRUCTURE, WeightedList.of(new MobSpawnSettings.SpawnerData(EntityType.PILLAGER, 1, 1))
                            )
                        )
                    )
                    .terrainAdapation(TerrainAdjustment.BEARD_THIN)
                    .build(),
                templates.getOrThrow(PillagerOutpostPools.START),
                7,
                ConstantHeight.of(VerticalAnchor.absolute(0)),
                true,
                Heightmap.Types.WORLD_SURFACE_WG
            )
        );
        context.register(
            BuiltinStructures.MINESHAFT,
            new MineshaftStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_MINESHAFT))
                    .generationStep(GenerationStep.Decoration.UNDERGROUND_STRUCTURES)
                    .build(),
                MineshaftStructure.Type.NORMAL
            )
        );
        context.register(
            BuiltinStructures.MINESHAFT_MESA,
            new MineshaftStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_MINESHAFT_MESA))
                    .generationStep(GenerationStep.Decoration.UNDERGROUND_STRUCTURES)
                    .build(),
                MineshaftStructure.Type.MESA
            )
        );
        context.register(
            BuiltinStructures.WOODLAND_MANSION,
            new WoodlandMansionStructure(new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_WOODLAND_MANSION)))
        );
        context.register(
            BuiltinStructures.JUNGLE_TEMPLE, new JungleTempleStructure(new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_JUNGLE_TEMPLE)))
        );
        context.register(
            BuiltinStructures.DESERT_PYRAMID, new DesertPyramidStructure(new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_DESERT_PYRAMID)))
        );
        context.register(BuiltinStructures.IGLOO, new IglooStructure(new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_IGLOO))));
        context.register(
            BuiltinStructures.SHIPWRECK, new ShipwreckStructure(new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_SHIPWRECK)), false)
        );
        context.register(
            BuiltinStructures.SHIPWRECK_BEACHED,
            new ShipwreckStructure(new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_SHIPWRECK_BEACHED)), true)
        );
        context.register(
            BuiltinStructures.SWAMP_HUT,
            new SwampHutStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_SWAMP_HUT))
                    .spawnOverrides(
                        Map.of(
                            MobCategory.MONSTER,
                            new StructureSpawnOverride(
                                StructureSpawnOverride.BoundingBoxType.PIECE, WeightedList.of(new MobSpawnSettings.SpawnerData(EntityType.WITCH, 1, 1))
                            ),
                            MobCategory.CREATURE,
                            new StructureSpawnOverride(
                                StructureSpawnOverride.BoundingBoxType.PIECE, WeightedList.of(new MobSpawnSettings.SpawnerData(EntityType.CAT, 1, 1))
                            )
                        )
                    )
                    .build()
            )
        );
        context.register(
            BuiltinStructures.STRONGHOLD,
            new StrongholdStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_STRONGHOLD)).terrainAdapation(TerrainAdjustment.BURY).build()
            )
        );
        context.register(
            BuiltinStructures.OCEAN_MONUMENT,
            new OceanMonumentStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_OCEAN_MONUMENT))
                    .spawnOverrides(
                        Map.of(
                            MobCategory.MONSTER,
                            new StructureSpawnOverride(
                                StructureSpawnOverride.BoundingBoxType.STRUCTURE, WeightedList.of(new MobSpawnSettings.SpawnerData(EntityType.GUARDIAN, 2, 4))
                            ),
                            MobCategory.UNDERGROUND_WATER_CREATURE,
                            new StructureSpawnOverride(StructureSpawnOverride.BoundingBoxType.STRUCTURE, MobSpawnSettings.EMPTY_MOB_LIST),
                            MobCategory.AXOLOTLS,
                            new StructureSpawnOverride(StructureSpawnOverride.BoundingBoxType.STRUCTURE, MobSpawnSettings.EMPTY_MOB_LIST)
                        )
                    )
                    .build()
            )
        );
        context.register(
            BuiltinStructures.OCEAN_RUIN_COLD,
            new OceanRuinStructure(new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_OCEAN_RUIN_COLD)), OceanRuinStructure.Type.COLD, 0.3F, 0.9F)
        );
        context.register(
            BuiltinStructures.OCEAN_RUIN_WARM,
            new OceanRuinStructure(new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_OCEAN_RUIN_WARM)), OceanRuinStructure.Type.WARM, 0.3F, 0.9F)
        );
        context.register(
            BuiltinStructures.FORTRESS,
            new NetherFortressStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_NETHER_FORTRESS))
                    .spawnOverrides(
                        Map.of(
                            MobCategory.MONSTER,
                            new StructureSpawnOverride(StructureSpawnOverride.BoundingBoxType.PIECE, NetherFortressStructure.FORTRESS_ENEMIES)
                        )
                    )
                    .generationStep(GenerationStep.Decoration.UNDERGROUND_DECORATION)
                    .build()
            )
        );
        context.register(
            BuiltinStructures.NETHER_FOSSIL,
            new NetherFossilStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_NETHER_FOSSIL))
                    .generationStep(GenerationStep.Decoration.UNDERGROUND_DECORATION)
                    .terrainAdapation(TerrainAdjustment.BEARD_THIN)
                    .build(),
                UniformHeight.of(VerticalAnchor.absolute(32), VerticalAnchor.belowTop(2))
            )
        );
        context.register(BuiltinStructures.END_CITY, new EndCityStructure(new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_END_CITY))));
        context.register(
            BuiltinStructures.BURIED_TREASURE,
            new BuriedTreasureStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_BURIED_TREASURE))
                    .generationStep(GenerationStep.Decoration.UNDERGROUND_STRUCTURES)
                    .build()
            )
        );
        context.register(
            BuiltinStructures.BASTION_REMNANT,
            new JigsawStructure(
                new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_BASTION_REMNANT)),
                templates.getOrThrow(BastionPieces.START),
                6,
                ConstantHeight.of(VerticalAnchor.absolute(33)),
                false
            )
        );
        context.register(
            BuiltinStructures.VILLAGE_PLAINS,
            new JigsawStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_VILLAGE_PLAINS)).terrainAdapation(TerrainAdjustment.BEARD_THIN).build(),
                templates.getOrThrow(PlainVillagePools.START),
                6,
                ConstantHeight.of(VerticalAnchor.absolute(0)),
                true,
                Heightmap.Types.WORLD_SURFACE_WG
            )
        );
        context.register(
            BuiltinStructures.VILLAGE_DESERT,
            new JigsawStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_VILLAGE_DESERT)).terrainAdapation(TerrainAdjustment.BEARD_THIN).build(),
                templates.getOrThrow(DesertVillagePools.START),
                6,
                ConstantHeight.of(VerticalAnchor.absolute(0)),
                true,
                Heightmap.Types.WORLD_SURFACE_WG
            )
        );
        context.register(
            BuiltinStructures.VILLAGE_SAVANNA,
            new JigsawStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_VILLAGE_SAVANNA))
                    .terrainAdapation(TerrainAdjustment.BEARD_THIN)
                    .build(),
                templates.getOrThrow(SavannaVillagePools.START),
                6,
                ConstantHeight.of(VerticalAnchor.absolute(0)),
                true,
                Heightmap.Types.WORLD_SURFACE_WG
            )
        );
        context.register(
            BuiltinStructures.VILLAGE_SNOWY,
            new JigsawStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_VILLAGE_SNOWY)).terrainAdapation(TerrainAdjustment.BEARD_THIN).build(),
                templates.getOrThrow(SnowyVillagePools.START),
                6,
                ConstantHeight.of(VerticalAnchor.absolute(0)),
                true,
                Heightmap.Types.WORLD_SURFACE_WG
            )
        );
        context.register(
            BuiltinStructures.VILLAGE_TAIGA,
            new JigsawStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_VILLAGE_TAIGA)).terrainAdapation(TerrainAdjustment.BEARD_THIN).build(),
                templates.getOrThrow(TaigaVillagePools.START),
                6,
                ConstantHeight.of(VerticalAnchor.absolute(0)),
                true,
                Heightmap.Types.WORLD_SURFACE_WG
            )
        );
        context.register(
            BuiltinStructures.RUINED_PORTAL_STANDARD,
            new RuinedPortalStructure(
                new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_RUINED_PORTAL_STANDARD)),
                List.of(
                    new RuinedPortalStructure.Setup(RuinedPortalPiece.VerticalPlacement.UNDERGROUND, 1.0F, 0.2F, false, false, true, false, 0.5F),
                    new RuinedPortalStructure.Setup(RuinedPortalPiece.VerticalPlacement.ON_LAND_SURFACE, 0.5F, 0.2F, false, false, true, false, 0.5F)
                )
            )
        );
        context.register(
            BuiltinStructures.RUINED_PORTAL_DESERT,
            new RuinedPortalStructure(
                new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_RUINED_PORTAL_DESERT)),
                new RuinedPortalStructure.Setup(RuinedPortalPiece.VerticalPlacement.PARTLY_BURIED, 0.0F, 0.0F, false, false, false, false, 1.0F)
            )
        );
        context.register(
            BuiltinStructures.RUINED_PORTAL_JUNGLE,
            new RuinedPortalStructure(
                new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_RUINED_PORTAL_JUNGLE)),
                new RuinedPortalStructure.Setup(RuinedPortalPiece.VerticalPlacement.ON_LAND_SURFACE, 0.5F, 0.8F, true, true, false, false, 1.0F)
            )
        );
        context.register(
            BuiltinStructures.RUINED_PORTAL_SWAMP,
            new RuinedPortalStructure(
                new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_RUINED_PORTAL_SWAMP)),
                new RuinedPortalStructure.Setup(RuinedPortalPiece.VerticalPlacement.ON_OCEAN_FLOOR, 0.0F, 0.5F, false, true, false, false, 1.0F)
            )
        );
        context.register(
            BuiltinStructures.RUINED_PORTAL_MOUNTAIN,
            new RuinedPortalStructure(
                new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_RUINED_PORTAL_MOUNTAIN)),
                List.of(
                    new RuinedPortalStructure.Setup(RuinedPortalPiece.VerticalPlacement.IN_MOUNTAIN, 1.0F, 0.2F, false, false, true, false, 0.5F),
                    new RuinedPortalStructure.Setup(RuinedPortalPiece.VerticalPlacement.ON_LAND_SURFACE, 0.5F, 0.2F, false, false, true, false, 0.5F)
                )
            )
        );
        context.register(
            BuiltinStructures.RUINED_PORTAL_OCEAN,
            new RuinedPortalStructure(
                new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_RUINED_PORTAL_OCEAN)),
                new RuinedPortalStructure.Setup(RuinedPortalPiece.VerticalPlacement.ON_OCEAN_FLOOR, 0.0F, 0.8F, false, false, true, false, 1.0F)
            )
        );
        context.register(
            BuiltinStructures.RUINED_PORTAL_NETHER,
            new RuinedPortalStructure(
                new Structure.StructureSettings(biomes.getOrThrow(BiomeTags.HAS_RUINED_PORTAL_NETHER)),
                new RuinedPortalStructure.Setup(RuinedPortalPiece.VerticalPlacement.IN_NETHER, 0.5F, 0.0F, false, false, false, true, 1.0F)
            )
        );
        context.register(
            BuiltinStructures.ANCIENT_CITY,
            new JigsawStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_ANCIENT_CITY))
                    .spawnOverrides(
                        Arrays.stream(MobCategory.values())
                            .collect(
                                Collectors.toMap(
                                    c -> (MobCategory)c, c -> new StructureSpawnOverride(StructureSpawnOverride.BoundingBoxType.STRUCTURE, WeightedList.of())
                                )
                            )
                    )
                    .generationStep(GenerationStep.Decoration.UNDERGROUND_DECORATION)
                    .terrainAdapation(TerrainAdjustment.BEARD_BOX)
                    .build(),
                templates.getOrThrow(AncientCityStructurePieces.START),
                Optional.of(Identifier.withDefaultNamespace("city_anchor")),
                7,
                ConstantHeight.of(VerticalAnchor.absolute(-27)),
                false,
                Optional.empty(),
                new JigsawStructure.MaxDistance(116),
                List.of(),
                JigsawStructure.DEFAULT_DIMENSION_PADDING,
                JigsawStructure.DEFAULT_LIQUID_SETTINGS
            )
        );
        context.register(
            BuiltinStructures.TRAIL_RUINS,
            new JigsawStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_TRAIL_RUINS))
                    .generationStep(GenerationStep.Decoration.UNDERGROUND_STRUCTURES)
                    .terrainAdapation(TerrainAdjustment.BURY)
                    .build(),
                templates.getOrThrow(TrailRuinsStructurePools.START),
                7,
                ConstantHeight.of(VerticalAnchor.absolute(-15)),
                false,
                Heightmap.Types.WORLD_SURFACE_WG
            )
        );
        context.register(
            BuiltinStructures.TRIAL_CHAMBERS,
            new JigsawStructure(
                new Structure.StructureSettings.Builder(biomes.getOrThrow(BiomeTags.HAS_TRIAL_CHAMBERS))
                    .generationStep(GenerationStep.Decoration.UNDERGROUND_STRUCTURES)
                    .terrainAdapation(TerrainAdjustment.ENCAPSULATE)
                    .spawnOverrides(
                        Arrays.stream(MobCategory.values())
                            .collect(
                                Collectors.toMap(
                                    c -> (MobCategory)c, c -> new StructureSpawnOverride(StructureSpawnOverride.BoundingBoxType.PIECE, WeightedList.of())
                                )
                            )
                    )
                    .build(),
                templates.getOrThrow(TrialChambersStructurePools.START),
                Optional.empty(),
                20,
                UniformHeight.of(VerticalAnchor.absolute(-40), VerticalAnchor.absolute(-20)),
                false,
                Optional.empty(),
                new JigsawStructure.MaxDistance(116),
                TrialChambersStructurePools.ALIAS_BINDINGS,
                new DimensionPadding(10),
                LiquidSettings.IGNORE_WATERLOGGING
            )
        );
    }
}

引用的其他类

  • BootstrapContext

    • 引用位置: 参数
  • Identifier

    • 引用位置: 方法调用
    • 关联成员: Identifier.withDefaultNamespace()
  • WeightedList

    • 引用位置: 方法调用
    • 关联成员: WeightedList.of()
  • MobCategory

    • 引用位置: 方法调用
    • 关联成员: MobCategory.values()
  • MobSpawnSettings

    • 引用位置: 方法调用/构造调用
    • 关联成员: MobSpawnSettings.SpawnerData(), SpawnerData()
  • VerticalAnchor

    • 引用位置: 方法调用
    • 关联成员: VerticalAnchor.absolute(), VerticalAnchor.belowTop()
  • ConstantHeight

    • 引用位置: 方法调用
    • 关联成员: ConstantHeight.of()
  • UniformHeight

    • 引用位置: 方法调用
    • 关联成员: UniformHeight.of()
  • Structure

    • 引用位置: 参数/方法调用/构造调用
    • 关联成员: Builder(), Structure.StructureSettings(), Structure.StructureSettings.Builder(), StructureSettings()
  • StructureSpawnOverride

    • 引用位置: 构造调用
    • 关联成员: StructureSpawnOverride()
  • DimensionPadding

    • 引用位置: 构造调用
    • 关联成员: DimensionPadding()
  • BuriedTreasureStructure

    • 引用位置: 构造调用
    • 关联成员: BuriedTreasureStructure()
  • DesertPyramidStructure

    • 引用位置: 构造调用
    • 关联成员: DesertPyramidStructure()
  • EndCityStructure

    • 引用位置: 构造调用
    • 关联成员: EndCityStructure()
  • IglooStructure

    • 引用位置: 构造调用
    • 关联成员: IglooStructure()
  • JigsawStructure

    • 引用位置: 方法调用/构造调用
    • 关联成员: JigsawStructure(), JigsawStructure.MaxDistance(), MaxDistance()
  • JungleTempleStructure

    • 引用位置: 构造调用
    • 关联成员: JungleTempleStructure()
  • MineshaftStructure

    • 引用位置: 构造调用
    • 关联成员: MineshaftStructure()
  • NetherFortressStructure

    • 引用位置: 构造调用
    • 关联成员: NetherFortressStructure()
  • NetherFossilStructure

    • 引用位置: 构造调用
    • 关联成员: NetherFossilStructure()
  • OceanMonumentStructure

    • 引用位置: 构造调用
    • 关联成员: OceanMonumentStructure()
  • OceanRuinStructure

    • 引用位置: 构造调用
    • 关联成员: OceanRuinStructure()
  • RuinedPortalStructure

    • 引用位置: 方法调用/构造调用
    • 关联成员: RuinedPortalStructure(), RuinedPortalStructure.Setup(), Setup()
  • ShipwreckStructure

    • 引用位置: 构造调用
    • 关联成员: ShipwreckStructure()
  • StrongholdStructure

    • 引用位置: 构造调用
    • 关联成员: StrongholdStructure()
  • SwampHutStructure

    • 引用位置: 构造调用
    • 关联成员: SwampHutStructure()
  • WoodlandMansionStructure

    • 引用位置: 构造调用
    • 关联成员: WoodlandMansionStructure()