tutorial:biomes
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:biomes [2020/10/17 02:18] – updated mappings hydos | tutorial:biomes [2022/08/16 20:50] (current) – DME mineblock11 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Adding Biomes ====== | + | 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. | + | |
- | Please use 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 9: | 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 81: | 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 107: | 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 | + | We need to specify |
- | We have to add our biome to it first. | + | The weight is a measurement of the chance the biome has to spawn. |
+ | A higher weight corresponds | ||
+ | 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 | ||
<code java> | <code java> | ||
Line 116: | Line 108: | ||
[...] | [...] | ||
- | | + | |
- | List< | + | |
- | | + | |
- | VanillaLayeredBiomeSourceAccessor.setBiomes(biomes); | + | |
- | } | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | <code java> | + | |
- | @Mixin(VanillaLayeredBiomeSource.class) | + | |
- | public interface VanillaLayeredBiomeSourceAccessor { | + | |
- | @Accessor(" | + | |
- | public static List< | + | |
- | throw new AssertionError(); | + | |
- | } | + | |
- | + | ||
- | @Accessor(" | + | |
- | public static void setBiomes(List< | + | |
- | throw new AssertionError(); | + | |
- | } | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | Secondly, 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 as an example. | + | |
- | We modify '' | + | |
- | + | ||
- | <code java> | + | |
- | public class ExampleMod implements ModInitializer { | + | |
- | @Override | + | |
- | public void onInitialize() { | + | |
- | [...] | + | |
- | + | ||
- | // SetBaseBiomesLayer.TEMPERATE_BIOMES is an array of raw biome IDs. | + | |
- | // We have to get the raw id of our biome and append it to TEMPERATE_BIOMES. | + | |
- | SetBaseBiomesLayerAccessor.setTemperateBiomes( | + | |
- | ArrayUtils.add(SetBaseBiomesLayerAccessor.getTemperateBiomes(), | + | |
- | } | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | <code java> | + | |
- | @Mixin(SetBaseBiomesLayer.class) | + | |
- | public interface SetBaseBiomesLayerAccessor { | + | |
- | @Accessor(" | + | |
- | public static int[] getTemperateBiomes() { | + | |
- | throw new AssertionError(); | + | |
- | } | + | |
- | + | ||
- | @Accessor(" | + | |
- | public static void setTemperateBiomes(int[] biomes) { | + | |
- | throw new AssertionError(); | + | |
} | } | ||
} | } | ||
Line 181: | Line 123: | ||
{{tutorial: | {{tutorial: | ||
+ |
tutorial/biomes.1602901100.txt.gz · Last modified: 2020/10/17 02:18 by hydos