tutorial:biomes_old
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tutorial:biomes_old [2024/08/25 13:27] – removed - external edit (Unknown date) 127.0.0.1 | tutorial:biomes_old [2024/08/25 13:30] (current) – solidblock | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Adding Biomes [1.16.3] ====== | ||
| + | > :!: **The tutorial applies for only old versions!** For versions 1.18 and beyond, biomes are made completely using JSON, see [[https:// | ||
| + | |||
| + | There are 3 steps that are required to add a biome to the world. | ||
| + | * Creating a biome | ||
| + | * Registering a biome | ||
| + | * Adding a biome to a climate zone in the world | ||
| + | |||
| + | In this tutorial, we will add new biome called obsiland biome, whose surface is covered with obsidian. | ||
| + | |||
| + | Note that this tutorial depends on [[https:// | ||
| + | If the API doesn' | ||
| + | |||
| + | ==== Creating a Biome ==== | ||
| + | To create a biome, use '' | ||
| + | Missing one property will likely cause the game to crash. | ||
| + | It is recommended to look at vanilla biomes (created in '' | ||
| + | |||
| + | <code java> | ||
| + | public class ExampleMod implements ModInitializer { | ||
| + | // SurfaceBuilder defines how the surface of your biome looks. | ||
| + | // We use custom surface builder for our biome to cover surface with obsidians. | ||
| + | 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() { | ||
| + | // We specify what entities spawn and what features generate in the biome. | ||
| + | // Aside from some structures, trees, rocks, plants and | ||
| + | // | ||
| + | // Vanilla configured features for biomes are defined in 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(); | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Registering Biomes ==== | ||
| + | We register our biome at the entrypoint '' | ||
| + | If you use your own surface builder, you will also have to register it. | ||
| + | |||
| + | <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, | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | You should also give your biome a language entry in your '' | ||
| + | |||
| + | <code JavaScript src/ | ||
| + | { | ||
| + | " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Adding a biome to a climate zone in the world ==== | ||
| + | We need to specify the climate to which the biome is added, the biome which we are adding, and the weight of the biome (a double value). | ||
| + | The weight is a measurement of the chance the biome has to spawn. | ||
| + | A higher weight corresponds to a higher chance for the biome to spawn, proportional to the weights of other biomes. | ||
| + | You may want to give your biome a higher weight during testing so you can find the biome more easily. | ||
| + | In this tutorial, we will add the custom biome to the TEMPERATE and COOL climates as an example. | ||
| + | |||
| + | <code java> | ||
| + | public class ExampleMod implements ModInitializer { | ||
| + | @Override | ||
| + | public void onInitialize() { | ||
| + | [...] | ||
| + | |||
| + | OverworldBiomes.addContinentalBiome(OBSILAND_KEY, | ||
| + | OverworldBiomes.addContinentalBiome(OBSILAND_KEY, | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Result ==== | ||
| + | **Congratulations!** Your biome should now be generating in the world! | ||
| + | You can use below command to find your biome in the world. | ||
| + | |||
| + | < | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | {{tutorial: | ||