VillagePlacements.java

net.minecraft.data.worldgen.placement.VillagePlacements

信息

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

    TODO

字段/常量

  • PILE_HAY_VILLAGE

    • 类型: ResourceKey<PlacedFeature>
    • 修饰符: public static final
    • 源码定位: L22
    • 说明:

      TODO

  • PILE_MELON_VILLAGE

    • 类型: ResourceKey<PlacedFeature>
    • 修饰符: public static final
    • 源码定位: L23
    • 说明:

      TODO

  • PILE_SNOW_VILLAGE

    • 类型: ResourceKey<PlacedFeature>
    • 修饰符: public static final
    • 源码定位: L24
    • 说明:

      TODO

  • PILE_ICE_VILLAGE

    • 类型: ResourceKey<PlacedFeature>
    • 修饰符: public static final
    • 源码定位: L25
    • 说明:

      TODO

  • PILE_PUMPKIN_VILLAGE

    • 类型: ResourceKey<PlacedFeature>
    • 修饰符: public static final
    • 源码定位: L26
    • 说明:

      TODO

  • OAK_VILLAGE

    • 类型: ResourceKey<PlacedFeature>
    • 修饰符: public static final
    • 源码定位: L27
    • 说明:

      TODO

  • ACACIA_VILLAGE

    • 类型: ResourceKey<PlacedFeature>
    • 修饰符: public static final
    • 源码定位: L28
    • 说明:

      TODO

  • SPRUCE_VILLAGE

    • 类型: ResourceKey<PlacedFeature>
    • 修饰符: public static final
    • 源码定位: L29
    • 说明:

      TODO

  • PINE_VILLAGE

    • 类型: ResourceKey<PlacedFeature>
    • 修饰符: public static final
    • 源码定位: L30
    • 说明:

      TODO

  • PATCH_CACTUS_VILLAGE

    • 类型: ResourceKey<PlacedFeature>
    • 修饰符: public static final
    • 源码定位: L31
    • 说明:

      TODO

  • FLOWER_PLAIN_VILLAGE

    • 类型: ResourceKey<PlacedFeature>
    • 修饰符: public static final
    • 源码定位: L32
    • 说明:

      TODO

  • PATCH_TAIGA_GRASS_VILLAGE

    • 类型: ResourceKey<PlacedFeature>
    • 修饰符: public static final
    • 源码定位: L33
    • 说明:

      TODO

  • PATCH_BERRY_BUSH_VILLAGE

    • 类型: ResourceKey<PlacedFeature>
    • 修饰符: public static final
    • 源码定位: L34
    • 说明:

      TODO

内部类/嵌套类型

构造器

方法

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

public static void bootstrap(BootstrapContext<PlacedFeature> context) @ L36

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

参数:

  • context: BootstrapContext

说明:

TODO

代码

public class VillagePlacements {
    public static final ResourceKey<PlacedFeature> PILE_HAY_VILLAGE = PlacementUtils.createKey("pile_hay");
    public static final ResourceKey<PlacedFeature> PILE_MELON_VILLAGE = PlacementUtils.createKey("pile_melon");
    public static final ResourceKey<PlacedFeature> PILE_SNOW_VILLAGE = PlacementUtils.createKey("pile_snow");
    public static final ResourceKey<PlacedFeature> PILE_ICE_VILLAGE = PlacementUtils.createKey("pile_ice");
    public static final ResourceKey<PlacedFeature> PILE_PUMPKIN_VILLAGE = PlacementUtils.createKey("pile_pumpkin");
    public static final ResourceKey<PlacedFeature> OAK_VILLAGE = PlacementUtils.createKey("oak");
    public static final ResourceKey<PlacedFeature> ACACIA_VILLAGE = PlacementUtils.createKey("acacia");
    public static final ResourceKey<PlacedFeature> SPRUCE_VILLAGE = PlacementUtils.createKey("spruce");
    public static final ResourceKey<PlacedFeature> PINE_VILLAGE = PlacementUtils.createKey("pine");
    public static final ResourceKey<PlacedFeature> PATCH_CACTUS_VILLAGE = PlacementUtils.createKey("patch_cactus");
    public static final ResourceKey<PlacedFeature> FLOWER_PLAIN_VILLAGE = PlacementUtils.createKey("flower_plain");
    public static final ResourceKey<PlacedFeature> PATCH_TAIGA_GRASS_VILLAGE = PlacementUtils.createKey("patch_taiga_grass");
    public static final ResourceKey<PlacedFeature> PATCH_BERRY_BUSH_VILLAGE = PlacementUtils.createKey("patch_berry_bush");
 
    public static void bootstrap(BootstrapContext<PlacedFeature> context) {
        HolderGetter<ConfiguredFeature<?, ?>> configuredFeatures = context.lookup(Registries.CONFIGURED_FEATURE);
        Holder<ConfiguredFeature<?, ?>> pileHay = configuredFeatures.getOrThrow(PileFeatures.PILE_HAY);
        Holder<ConfiguredFeature<?, ?>> pileMelon = configuredFeatures.getOrThrow(PileFeatures.PILE_MELON);
        Holder<ConfiguredFeature<?, ?>> pileSnow = configuredFeatures.getOrThrow(PileFeatures.PILE_SNOW);
        Holder<ConfiguredFeature<?, ?>> pileIce = configuredFeatures.getOrThrow(PileFeatures.PILE_ICE);
        Holder<ConfiguredFeature<?, ?>> pilePumpkin = configuredFeatures.getOrThrow(PileFeatures.PILE_PUMPKIN);
        Holder<ConfiguredFeature<?, ?>> oak = configuredFeatures.getOrThrow(TreeFeatures.OAK);
        Holder<ConfiguredFeature<?, ?>> acacia = configuredFeatures.getOrThrow(TreeFeatures.ACACIA);
        Holder<ConfiguredFeature<?, ?>> spruce = configuredFeatures.getOrThrow(TreeFeatures.SPRUCE);
        Holder<ConfiguredFeature<?, ?>> pine = configuredFeatures.getOrThrow(TreeFeatures.PINE);
        Holder<ConfiguredFeature<?, ?>> cactus = configuredFeatures.getOrThrow(VegetationFeatures.CACTUS);
        Holder<ConfiguredFeature<?, ?>> flowerPlain = configuredFeatures.getOrThrow(VegetationFeatures.FLOWER_PLAIN);
        Holder<ConfiguredFeature<?, ?>> taigaGrass = configuredFeatures.getOrThrow(VegetationFeatures.TAIGA_GRASS);
        Holder<ConfiguredFeature<?, ?>> berryBush = configuredFeatures.getOrThrow(VegetationFeatures.BERRY_BUSH);
        PlacementUtils.register(context, PILE_HAY_VILLAGE, pileHay);
        PlacementUtils.register(context, PILE_MELON_VILLAGE, pileMelon);
        PlacementUtils.register(context, PILE_SNOW_VILLAGE, pileSnow);
        PlacementUtils.register(context, PILE_ICE_VILLAGE, pileIce);
        PlacementUtils.register(context, PILE_PUMPKIN_VILLAGE, pilePumpkin);
        PlacementUtils.register(context, OAK_VILLAGE, oak, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING));
        PlacementUtils.register(context, ACACIA_VILLAGE, acacia, PlacementUtils.filteredByBlockSurvival(Blocks.ACACIA_SAPLING));
        PlacementUtils.register(context, SPRUCE_VILLAGE, spruce, PlacementUtils.filteredByBlockSurvival(Blocks.SPRUCE_SAPLING));
        PlacementUtils.register(context, PINE_VILLAGE, pine, PlacementUtils.filteredByBlockSurvival(Blocks.SPRUCE_SAPLING));
        PlacementUtils.register(
            context,
            PATCH_CACTUS_VILLAGE,
            cactus,
            CountPlacement.of(10),
            RandomOffsetPlacement.ofTriangle(7, 3),
            BlockPredicateFilter.forPredicate(
                BlockPredicate.allOf(BlockPredicate.ONLY_IN_AIR_PREDICATE, BlockPredicate.wouldSurvive(Blocks.CACTUS.defaultBlockState(), BlockPos.ZERO))
            )
        );
        PlacementUtils.register(
            context,
            FLOWER_PLAIN_VILLAGE,
            flowerPlain,
            CountPlacement.of(64),
            RandomOffsetPlacement.ofTriangle(6, 2),
            BlockPredicateFilter.forPredicate(BlockPredicate.ONLY_IN_AIR_PREDICATE)
        );
        PlacementUtils.register(
            context,
            PATCH_TAIGA_GRASS_VILLAGE,
            taigaGrass,
            CountPlacement.of(32),
            RandomOffsetPlacement.ofTriangle(7, 3),
            BlockPredicateFilter.forPredicate(BlockPredicate.ONLY_IN_AIR_PREDICATE)
        );
        PlacementUtils.register(
            context,
            PATCH_BERRY_BUSH_VILLAGE,
            berryBush,
            CountPlacement.of(96),
            RandomOffsetPlacement.ofTriangle(7, 3),
            BlockPredicateFilter.forPredicate(
                BlockPredicate.allOf(BlockPredicate.ONLY_IN_AIR_PREDICATE, BlockPredicate.matchesBlocks(Direction.DOWN.getUnitVec3i(), Blocks.GRASS_BLOCK))
            )
        );
    }
}

引用的其他类

  • BootstrapContext

    • 引用位置: 参数
  • PlacementUtils

    • 引用位置: 方法调用
    • 关联成员: PlacementUtils.createKey(), PlacementUtils.filteredByBlockSurvival(), PlacementUtils.register()
  • ResourceKey

    • 引用位置: 字段
  • BlockPredicate

    • 引用位置: 方法调用
    • 关联成员: BlockPredicate.allOf(), BlockPredicate.matchesBlocks(), BlockPredicate.wouldSurvive()
  • BlockPredicateFilter

    • 引用位置: 方法调用
    • 关联成员: BlockPredicateFilter.forPredicate()
  • CountPlacement

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

    • 引用位置: 参数/字段
  • RandomOffsetPlacement

    • 引用位置: 方法调用
    • 关联成员: RandomOffsetPlacement.ofTriangle()