tutorial:biomes
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:biome [2020/09/04 19:50] – Get rid of access wideners siglong | tutorial:biomes [2020/10/17 02:18] – updated mappings hydos | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Adding | + | ====== Adding |
**NOTE:** There is [[https:// | **NOTE:** There is [[https:// | ||
- | Read this tutorial as a workaround until it gets merged. | + | Please use this tutorial as a workaround until it gets merged. |
==== Introduction ==== | ==== Introduction ==== | ||
- | |||
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 22: | Line 21: | ||
// 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 108: | Line 107: | ||
==== 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 '' | + | The vanilla biomes used in the overworld is defined |
- | We have to add our biome to '' | + | We have to add our biome to it first. |
+ | |||
+ | <code java> | ||
+ | public class ExampleMod implements ModInitializer { | ||
+ | @Override | ||
+ | public void onInitialize() { | ||
+ | [...] | ||
+ | |||
+ | // We have to copy existing List because it is immutable. | ||
+ | List< | ||
+ | biomes.add(OBSILAND_KEY); | ||
+ | VanillaLayeredBiomeSourceAccessor.setBiomes(biomes); | ||
+ | } | ||
+ | } | ||
+ | </ | ||
<code java> | <code java> | ||
@Mixin(VanillaLayeredBiomeSource.class) | @Mixin(VanillaLayeredBiomeSource.class) | ||
- | public | + | public |
- | @ModifyArgs(method = "<init>(JZZLnet/ | + | @Accessor("BIOMES" |
- | | + | public static List<RegistryKey< |
- | Registry< | + | throw new AssertionError(); |
- | Stream<Supplier< | + | } |
- | | + | |
- | args.set(0, biomes); | + | |
+ | | ||
+ | | ||
} | } | ||
} | } | ||
</ | </ | ||
- | We need to specify the climate to which the biome is added. | + | 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. | In this tutorial, we will add the custom biome to the temperate climate as an example. | ||
We modify '' | We modify '' |
tutorial/biomes.txt · Last modified: 2022/08/16 20:50 by mineblock11