zh_cn:tutorial:ores
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
zh_cn:tutorial:ores [2021/09/23 00:15] – [在群系中添加矿石] solidblock | zh_cn:tutorial:ores [2021/09/23 00:19] – [迭代生物群系注册表] solidblock | ||
---|---|---|---|
Line 43: | Line 43: | ||
{{tutorial: | {{tutorial: | ||
- | ==== 迭代生物群系注册表 | + | ==== 添加到下界生物群系 ==== |
+ | 本段落将会基于前面的段落添加矿石到下界生物群系。 | ||
- | 接下来,我们需要处理已注册的所有生物群系以及将来将要注册的所有生物群落(由其他模块添加)。 我们首先遍历当前注册表,然后注册一个侦听器,以供将来添加。 | + | 在下界,需要替换的方块和主世界地不同,所以需要把 '' |
- | <code java [enable_line_numbers=" | + | <code java> |
- | @Override | + | public |
- | public | + | |
- | //Loop over existing biomes | + | .configure(new OreFeatureConfig( |
- | Registry.BIOME.forEach(this:: | + | OreFeatureConfig.Rules.BASE_STONE_NETHER, |
+ | | ||
+ | 9)) | ||
+ | .range(new RangeDecoratorConfig( | ||
+ | UniformHeightProvider.create(YOffset.fixed(0), | ||
+ | .spreadHorizontally() | ||
+ | | ||
- | //Listen for other biomes being registered | + | @Override |
- | RegistryEntryAddedCallback.event(Registry.BIOME).register((i, identifier, biome) -> handleBiome(biome)); | + | |
+ | RegistryKey< | ||
+ | new Identifier(" | ||
+ | Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, | ||
+ | BiomeModifications.addFeature(BiomeSelectors.foundInTheNether(), GenerationStep.Feature.UNDERGROUND_ORES, | ||
+ | } | ||
} | } | ||
</ | </ | ||
+ | |||
+ | ==== 添加到末地生物群系 ==== | ||
+ | 本段落将会基于主世界的代码添加矿石到末地生物群系。 | ||
+ | |||
+ | 在末地,基础方块是末地石,所以需要把 '' | ||
+ | |||
+ | <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(), | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
==== 结论 ==== | ==== 结论 ==== |
zh_cn/tutorial/ores.txt · Last modified: 2024/05/21 10:00 by sjk1949