User Tools

Site Tools


← Go back to the homepage

Fabric Tutorials


These pages will help you setup a productive development environment and semi-automated releases.


These pages are essential must-reads when modding with Fabric, and modding Minecraft in general, if you are new to modding, it is recommended you read the following.


Blocks and Block Entities

Data Generation

World Generation


These pages will guide you through Mojang's Brigadier library which allows you to create commands with complex arguments and actions.


These pages will guide you through using the many events included in Fabric API, and how to create your own events for you or other mods to use.



Mixins & ASM

These pages will guide you through the usage of SpongePowered's Mixin library, which is a highly complex topic. We recommend you read these pages thoroughly.



Contribute to Fabric


Adding World Presets

A WorldPreset is a wrapper class around a ChunkGenerator. The preset is shown on the “More World Options” screen, on the “World Type” button. The vanilla world presets are Default, Large Biomes, AMPLIFIED, Single Biome, Superflat, and Debug Mode.

In this tutorial, we will add a simple world preset which generates nothing in a world.

Creating a World Preset

A world preset requires a ChunkGenerator. You can create your own, but here, we will modify the FlatChunkGenerator to create a void world.

In order to implement a preset, we first need access to the WorldPresets$Registrar inner class. For that, we can use a simple access widener. This could be done without an access widener, but it is much simpler to use one in this case. Your access widener should look like this:

accessWidener   v1      named
accessible      class   net/minecraft/world/gen/WorldPresets$Registrar

Don't forget to add the neccessary entries to your fabric.mod.json and build.gradle files!

Once we have access to the Registrar class, the preset can be implemented in one mixin:

// if you can't mixin here, make sure your access widener is set up correctly!
public abstract class WorldPresetMixin {
    // defining our registry key. this key provides an Identifier for our preset, that we can use for our lang files and data elements.
    private static final RegistryKey<WorldPreset> VOID_WORLD = RegistryKey.of(Registry.WORLD_PRESET_KEY, new Identifier("wiki-example", "void_world"));
    @Shadow protected abstract RegistryEntry<WorldPreset> register(RegistryKey<WorldPreset> key, DimensionOptions dimensionOptions);
    @Shadow protected abstract DimensionOptions createOverworldOptions(ChunkGenerator chunkGenerator);
    @Inject(method = "initAndGetDefault", at = @At("RETURN"))
    private void addPresets(CallbackInfoReturnable<RegistryEntry<WorldPreset>> cir) {
        // the register() method is shadowed from the target class
        this.register(VOID_WORLD, this.createOverworldOptions(
                // a FlatChunkGenerator is the easiest way to get a void world, but you can replace this FlatChunkGenerator constructor with a NoiseChunkGenerator, or your own custom ChunkGenerator.
                new FlatChunkGenerator(
                        // passing null will use the default structure set
                        new FlatChunkGeneratorConfig(
                                // we don't need to overwrite the structure set

Don't forget to add the mixin to your mixins.json file!

Our preset is registered, but if you load up the game, nothing will show up in the menu. This is because the presets that are actually displayed in the More World Options menu are controlled via tags.

In order for the preset to show up, we'll need to add it to the normal WorldPreset tag. Create a new file in your resources directory, at src/main/resources/data/minecraft/tags/worldgen/world_preset called normal.json. Note that the tag is stored under the minecraft namespace, not your mod's.

  "replace": false,
  "values": [

And, of course, you'll probably want a translation file. I'm using English, so my lang file will be at src/main/assets/wiki-example/lang/en_us.json:

  "": "Nothing but Void"

And you're done!

For more information, the code used in this example can be found on Github.

tutorial/world_presets.txt · Last modified: 2022/09/07 14:42 by miir