【问题标题】:Minecraft Modding - with FabricMinecraft 改装 - 带面料
【发布时间】:2021-08-19 18:10:26
【问题描述】:

我刚开始做我的世界模组,我有点不确定该怎么做。我正在尝试将铂金添加到 Fabric 改装的我的世界游戏中,并且一切正常,但我不确定如何让我的铂金矿石像其他矿石一样随机生成。我看过很多视频,但没有一个对我很有帮助。

我最后的问题是:

如何在 y = 12 - 15 处随机生成我的铂矿石,而无需手动放置?

【问题讨论】:

    标签: minecraft minecraft-fabric


    【解决方案1】:

    您需要创建一个 ConfiguredFeature。确保在 onInitialize 注册您的 ConfiguredFeature。随意更改值以适合您的模组。

    public class ExampleMod implements ModInitializer {
      private static ConfiguredFeature<?, ?> ORE_WOOL_OVERWORLD = Feature.ORE
        .configure(new OreFeatureConfig(
          OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
          Blocks.WHITE_WOOL.getDefaultState(),
          9)) // vein size
        .decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(
        UniformHeightProvider.create(
        YOffset.fixed(0), 
        YOffset.fixed(64)))))
        .spreadHorizontally()
        .repeat(20); // number of veins per chunk
     
      @Override
      public void onInitialize() {
        RegistryKey<ConfiguredFeature<?, ?>> oreWoolOverworld = RegistryKey.of(Registry.CONFIGURED_FEATURE_WORLDGEN,
            new Identifier("tutorial", "ore_wool_overworld"));
        Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, oreWoolOverworld.getValue(), ORE_WOOL_OVERWORLD);
        BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), GenerationStep.Feature.UNDERGROUND_ORES, oreWoolOverworld);
      }
    }
    

    (取自https://fabricmc.net/wiki/tutorial:ores

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-07-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-06
      • 2015-04-12
      • 1970-01-01
      相关资源
      最近更新 更多