tutorial:biomes
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:biome [2020/09/04 17:40] – Use hex for color siglong | tutorial:biomes [2022/08/16 20:50] (current) – DME mineblock11 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Adding a Biome ====== | + | DELETEME //**For versions 1.18 and beyond, biomes can be made completely using JSON, [[https://minecraft.fandom.com/wiki/Biome/JSON_format|take a look the Minecraft Wikia for more information.]]**.// |
- | **NOTE:** There is [[https://github.com/FabricMC/fabric/pull/1036|a ongoing pull request on Fabric API]] that adds biome API for 1.16.2. | + | |
- | Read this tutorial as a workaround until it gets merged. | + | |
- | + | ||
- | ==== Introduction ==== | + | |
+ | ====== Adding Biomes [1.16.3] ====== | ||
There are 3 steps that are required to add a biome to the world. | There are 3 steps that are required to add a biome to the world. | ||
* Creating a biome | * Creating a biome | ||
Line 10: | Line 7: | ||
* Adding a biome to a climate zone in the world | * 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 obsidians. | + | 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 ==== | ==== Creating a Biome ==== | ||
Line 22: | Line 22: | ||
// We use custom surface builder for our biome to cover surface with obsidians. | // We use custom surface builder for our biome to cover surface with obsidians. | ||
private static final ConfiguredSurfaceBuilder< | private static final ConfiguredSurfaceBuilder< | ||
- | .method_30478(new TernarySurfaceConfig( | + | .withConfig(new TernarySurfaceConfig( |
Blocks.OBSIDIAN.getDefaultState(), | Blocks.OBSIDIAN.getDefaultState(), | ||
Blocks.DIRT.getDefaultState(), | Blocks.DIRT.getDefaultState(), | ||
Line 82: | Line 82: | ||
public void onInitialize() { | public void onInitialize() { | ||
Registry.register(BuiltinRegistries.CONFIGURED_SURFACE_BUILDER, | Registry.register(BuiltinRegistries.CONFIGURED_SURFACE_BUILDER, | ||
- | |||
Registry.register(BuiltinRegistries.BIOME, | Registry.register(BuiltinRegistries.BIOME, | ||
- | BuiltinBiomesAccessor.getRawIdMap().put(BuiltinRegistries.BIOME.getRawId(OBSILAND), | ||
- | } | ||
- | } | ||
- | </ | ||
- | |||
- | <code java> | ||
- | @Mixin(BuiltinBiomes.class) | ||
- | public interface BuiltinBiomesAccessor { | ||
- | @Accessor(" | ||
- | public static Int2ObjectMap< | ||
- | throw new AssertionError(); | ||
} | } | ||
} | } | ||
Line 108: | Line 96: | ||
==== Adding a biome to a climate zone in the world ==== | ==== Adding a biome to a climate zone in the world ==== | ||
- | The vanilla biomes used in the overworld is defined '' | + | 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). |
- | We have to add our biome to '' | + | The weight is a measurement |
- | + | A higher weight corresponds to a higher chance for the biome to spawn, proportional to the weights of other biomes. | |
- | <code java> | + | You may want to give your biome a higher weight during testing so you can find the biome more easily. |
- | @Mixin(VanillaLayeredBiomeSource.class) | + | In this tutorial, we will add the custom biome to the TEMPERATE and COOL climates |
- | public class VanillaLayeredBiomeSourceMixin { | + | |
- | @ModifyArgs(method = "< | + | |
- | private static void addOverworldBiomes(Args args, long seed, boolean legacyBiomeInitLayer, | + | |
- | Registry< | + | |
- | Stream< | + | |
- | | + | |
- | | + | |
- | } | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | We need to specify the climate to which the biome is added. | + | |
- | In this tutorial, we will add the custom biome to the temperate climate | + | |
- | We modify '' | + | |
<code java> | <code java> | ||
Line 134: | Line 108: | ||
[...] | [...] | ||
- | | + | |
- | | + | |
- | SetBaseBiomesLayer.TEMPERATE_BIOMES = ArrayUtils.add(SetBaseBiomesLayer.TEMPERATE_BIOMES, BuiltinRegistries.BIOME.getRawId(OBSILAND)); | + | |
} | } | ||
} | } | ||
- | </ | ||
- | |||
- | We have to use [[tutorial: | ||
- | Your '' | ||
- | |||
- | < | ||
- | accessWidener v1 named | ||
- | |||
- | accessible field net/ | ||
- | mutable | ||
</ | </ | ||
Line 160: | Line 123: | ||
{{tutorial: | {{tutorial: | ||
+ |
tutorial/biomes.1599241217.txt.gz · Last modified: 2020/09/04 17:40 by siglong