Minecraft Modding - with Fabric



我刚刚开始minecraft改装,我有点不确定该怎么做。我正试图将白金添加到Fabric改装的minecraft游戏中,这一切都奏效了,但我不确定如何让我的白金矿石像其他游戏一样随机生成。我看了很多视频,但没有一个对我很有帮助。

最后我的问题是:

如何在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);
}
}

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

最新更新