zh_cn:tutorial:ores
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Previous revisionNext revision | |||
— | zh_cn:tutorial:ores [2021/09/23 00:19] – [迭代生物群系注册表] solidblock | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== 在世界中添加矿石 ====== | ||
+ | 许多模组会添加自己的矿石,您需要找到一种方法以将其放置在现有生物群系中让玩家寻找。在本教程中,我们将研究将矿石添加到现有生物群系以及其他模组添加的生物群系。将矿石添加到生物群系需要2个步骤。 | ||
+ | * 制作一个 ConfiguredFeature,定义你的矿石方块如何生成。 | ||
+ | * 使用 [[https:// | ||
+ | |||
+ | 注意 Biome Modification API 仍是实验性的。如果 API 不起作用,考虑 [[? | ||
+ | |||
+ | 我们假设您此时已经创建了自己的矿石。本教程中,我们使用羊毛方块进行替换。你可以适时将羊毛改成你自己的矿石。 | ||
+ | ==== 添加到主世界生物群系 ==== | ||
+ | 本段落将会在主世界生成矿石。 | ||
+ | |||
+ | 我们需要创建一个 ConfiguredFeature,确保在 '' | ||
+ | |||
+ | <code java> | ||
+ | public class ExampleMod implements ModInitializer { | ||
+ | private static ConfiguredFeature<?, | ||
+ | .configure(new OreFeatureConfig( | ||
+ | OreFeatureConfig.Rules.BASE_STONE_OVERWORLD, | ||
+ | Blocks.WHITE_WOOL.getDefaultState(), | ||
+ | 9)) // Vein size | ||
+ | .range(new RangeDecoratorConfig( | ||
+ | // You can also use one of the other height providers if you don't want a uniform distribution | ||
+ | UniformHeightProvider.create(YOffset.aboveBottom(0), | ||
+ | .spreadHorizontally() | ||
+ | .repeat(20); | ||
+ | |||
+ | @Override | ||
+ | public void onInitialize() { | ||
+ | RegistryKey< | ||
+ | new Identifier(" | ||
+ | Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, | ||
+ | BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | === 结果 === | ||
+ | 检查你的世界生成结果时,记得要创建新世界。你应该看见羊毛在主世界生成了。你可以使用下面的命令移除周围的石头方块。 | ||
+ | < | ||
+ | /fill ~-8 0 ~-8 ~8 ~ ~8 minecraft: | ||
+ | </ | ||
+ | |||
+ | {{tutorial: | ||
+ | |||
+ | ==== 添加到下界生物群系 ==== | ||
+ | 本段落将会基于前面的段落添加矿石到下界生物群系。 | ||
+ | |||
+ | 在下界,需要替换的方块和主世界地不同,所以需要把 '' | ||
+ | |||
+ | <code java> | ||
+ | public class ExampleMod implements ModInitializer { | ||
+ | private static ConfiguredFeature<?, | ||
+ | .configure(new OreFeatureConfig( | ||
+ | OreFeatureConfig.Rules.BASE_STONE_NETHER, | ||
+ | Blocks.WHITE_WOOL.getDefaultState(), | ||
+ | 9)) | ||
+ | .range(new RangeDecoratorConfig( | ||
+ | UniformHeightProvider.create(YOffset.fixed(0), | ||
+ | .spreadHorizontally() | ||
+ | .repeat(20); | ||
+ | |||
+ | @Override | ||
+ | public void onInitialize() { | ||
+ | RegistryKey< | ||
+ | new Identifier(" | ||
+ | Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, | ||
+ | BiomeModifications.addFeature(BiomeSelectors.foundInTheNether(), | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ==== 添加到末地生物群系 ==== | ||
+ | 本段落将会基于主世界的代码添加矿石到末地生物群系。 | ||
+ | |||
+ | 在末地,基础方块是末地石,所以需要把 '' | ||
+ | |||
+ | <code java> | ||
+ | public class ExampleMod implements ModInitializer { | ||
+ | private static ConfiguredFeature<?, | ||
+ | .configure(new OreFeatureConfig( | ||
+ | new BlockMatchRuleTest(Blocks.END_STONE), | ||
+ | Blocks.WHITE_WOOL.getDefaultState(), | ||
+ | 9)) | ||
+ | .range(new RangeDecoratorConfig( | ||
+ | UniformHeightProvider.create(YOffset.fixed(0), | ||
+ | .spreadHorizontally() | ||
+ | .repeat(20); | ||
+ | |||
+ | @Override | ||
+ | public void onInitialize() { | ||
+ | RegistryKey< | ||
+ | new Identifier(" | ||
+ | Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, | ||
+ | BiomeModifications.addFeature(BiomeSelectors.foundInTheEnd(), | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== 结论 ==== | ||
+ | 您应该会在整个世界中看到石英矿石的生成: | ||
+ | |||
+ | {{https:// | ||
+ | |||
zh_cn/tutorial/ores.txt · Last modified: 2024/05/21 10:00 by sjk1949