Minecraft 改装 - 使用织物
Minecraft Modding - with Fabric
我刚开始制作 Minecraft 模组,我有点不确定该怎么做。我正在尝试将 Platinum 添加到 Fabric modded minecraft 游戏中并且一切正常,但我不确定如何让我的铂金矿石像其他矿石一样随机生成。我看过很多视频,但 none 我看到的视频非常有帮助。
最后我的问题是:
如何在 y = 12 - 15 处随机生成我的铂金矿石而无需手动放置?
您需要创建一个 ConfiguredFeature。确保在 onInitialize 注册您的 ConfiguredFeature。请随意更改值以适合您的 mod.
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);
}
}
我刚开始制作 Minecraft 模组,我有点不确定该怎么做。我正在尝试将 Platinum 添加到 Fabric modded minecraft 游戏中并且一切正常,但我不确定如何让我的铂金矿石像其他矿石一样随机生成。我看过很多视频,但 none 我看到的视频非常有帮助。
最后我的问题是:
如何在 y = 12 - 15 处随机生成我的铂金矿石而无需手动放置?
您需要创建一个 ConfiguredFeature。确保在 onInitialize 注册您的 ConfiguredFeature。请随意更改值以适合您的 mod.
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);
}
}