zh_cn:tutorial:biomes_old
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| zh_cn:tutorial:biomes_old [2024/08/25 13:27] – removed - external edit (Unknown date) 127.0.0.1 | zh_cn:tutorial:biomes_old [2024/08/25 13:30] (current) – solidblock | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== 添加生物群系(1.16.3) ====== | ||
| + | > :!: **本教程仅适用于旧版本!**对于 1.18 以上的版本,生物群系是完全使用 JSON 完成的,更多信息请参见 [[https:// | ||
| + | |||
| + | 添加生物群系有以下三个步骤: | ||
| + | * 创建生物群系 | ||
| + | * 注册生物群系 | ||
| + | * 将生物群系添加到世界的气候区域 | ||
| + | |||
| + | 本教程中,我们添加一个叫做黑曜石之地的生物群系,该生物群系表面覆盖着黑曜石。 | ||
| + | |||
| + | 注意本教程依赖标记为实验性的 [[https:// | ||
| + | |||
| + | ==== 创建生物群系 ==== | ||
| + | 如需创建生物群系,使用 '' | ||
| + | |||
| + | <code java> | ||
| + | public class ExampleMod implements ModInitializer { | ||
| + | // SurfaceBuilder 定义了生物群系表面应该看起来怎样。 | ||
| + | // 我们使用自定义的表面构造器以使得生物群系表满铺满黑曜石。 | ||
| + | private static final ConfiguredSurfaceBuilder< | ||
| + | .withConfig(new TernarySurfaceConfig( | ||
| + | Blocks.OBSIDIAN.getDefaultState(), | ||
| + | Blocks.DIRT.getDefaultState(), | ||
| + | Blocks.GRAVEL.getDefaultState())); | ||
| + | |||
| + | private static final Biome OBSILAND = createObsiland(); | ||
| + | |||
| + | private static Biome createObsiland() { | ||
| + | // 指定哪些实体可以生成,以及生物群系生成哪些地物。 | ||
| + | // 除了某些结构、树木、岩石、植物、自定义实体之外,这些每个生物群系都是几乎一样的。 | ||
| + | // 原版配置的生物群系地物是在 DefaultBiomeFeatures 中定义的。 | ||
| + | |||
| + | SpawnSettings.Builder spawnSettings = new SpawnSettings.Builder(); | ||
| + | DefaultBiomeFeatures.addFarmAnimals(spawnSettings); | ||
| + | DefaultBiomeFeatures.addMonsters(spawnSettings, | ||
| + | |||
| + | GenerationSettings.Builder generationSettings = new GenerationSettings.Builder(); | ||
| + | generationSettings.surfaceBuilder(OBSIDIAN_SURFACE_BUILDER); | ||
| + | DefaultBiomeFeatures.addDefaultUndergroundStructures(generationSettings); | ||
| + | DefaultBiomeFeatures.addLandCarvers(generationSettings); | ||
| + | DefaultBiomeFeatures.addDefaultLakes(generationSettings); | ||
| + | DefaultBiomeFeatures.addDungeons(generationSettings); | ||
| + | DefaultBiomeFeatures.addMineables(generationSettings); | ||
| + | DefaultBiomeFeatures.addDefaultOres(generationSettings); | ||
| + | DefaultBiomeFeatures.addDefaultDisks(generationSettings); | ||
| + | DefaultBiomeFeatures.addSprings(generationSettings); | ||
| + | DefaultBiomeFeatures.addFrozenTopLayer(generationSettings); | ||
| + | |||
| + | return (new Biome.Builder()) | ||
| + | .precipitation(Biome.Precipitation.RAIN) | ||
| + | .category(Biome.Category.NONE) | ||
| + | .depth(0.125F) | ||
| + | .scale(0.05F) | ||
| + | .temperature(0.8F) | ||
| + | .downfall(0.4F) | ||
| + | .effects((new BiomeEffects.Builder()) | ||
| + | .waterColor(0x3f76e4) | ||
| + | .waterFogColor(0x050533) | ||
| + | .fogColor(0xc0d8ff) | ||
| + | .skyColor(0x77adff) | ||
| + | .build()) | ||
| + | .spawnSettings(spawnSettings.build()) | ||
| + | .generationSettings(generationSettings.build()) | ||
| + | .build(); | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== 注册生物群系 ==== | ||
| + | 我们在入口点 '' | ||
| + | |||
| + | <code java> | ||
| + | public class ExampleMod implements ModInitializer { | ||
| + | public static final RegistryKey< | ||
| + | |||
| + | @Override | ||
| + | public void onInitialize() { | ||
| + | Registry.register(BuiltinRegistries.CONFIGURED_SURFACE_BUILDER, | ||
| + | Registry.register(BuiltinRegistries.BIOME, | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | 此外,你还需要在 '' | ||
| + | |||
| + | <code JavaScript src/ | ||
| + | { | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | <code JavaScript src/ | ||
| + | { | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== 添加生物群系到世界的气候区域 ==== | ||
| + | 我们需要指定气候(生物群系添加到此气候中),此外还需要指定我们添加的生物群系,以及生物群系的权重(双精度值)。权重用来衡量生物群系生成的概率。更高的权重对应生物群系生成更高几率,相对于其他生物群系。测试过程中,可以给生物群系更高的权重,从而更容易找到它。此教程中,作为例子,我们将这个自定义的生物群系添加到 TEMPERATE 和 COOL 气候中。 | ||
| + | |||
| + | <code java> | ||
| + | public class ExampleMod implements ModInitializer { | ||
| + | @Override | ||
| + | public void onInitialize() { | ||
| + | [...] | ||
| + | |||
| + | OverworldBiomes.addContinentalBiome(OBSILAND_KEY, | ||
| + | OverworldBiomes.addContinentalBiome(OBSILAND_KEY, | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== 结果 ==== | ||
| + | **好耶!**你的生物群系应该会在世界生成了!你可以使用下面的命令来在世界中找到你的生物群系。 | ||
| + | |||
| + | < | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | {{tutorial: | ||