question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom GeneratorType for Custom World Types

See original GitHub issue

Issue for pre 1.16: #297

Introduction

It’s not uncommon for mods to provide their own world type, e.g. for skyblock. Unfortunately, this isn’t trivial for a mod to add and I’d propose to make a module for this in the API. Some of the things that need to be done:

  • Allow creation of a GeneratorType object.
  • Simplify the process of providing ChunkGenerators for each dimension
  • Fix the parsing of server.properties for the GeneratorOptions

So far I have a rough idea what this would look like, but this definitely requires some thought and some input from experienced contributors.

GeneratorType

GeneratorType is a client-only abstract class with private constructor. It is required in order to provide the MinecraftClient with a selection on the world creation screen. While there is no proper registry, there exists a protected (mutable) List<GeneratorType> VALUES that allows aading new ones. On the client, this class also provides the GeneratorOptions.

In order to make this class accessible to mods, I would suggest using an accesswidener to make the class extensible, Then, Fabric could provide a FabricGeneratorType extends GeneratorType which should be either extensible or use a builder pattern. This then allows mods to provide their own ChunkGenerators/DimensionOptions for each dimension.

GeneratorOptions

GeneratorOptions is the class that actually holds all information needed to generate the world. On the client, it’s created using GeneratorType.method_29079(...), on the server it is parsed from the properties file using GeneratorOptions.fromProperties(...) This class is fairly accessible and doesn’t need to be extended, however the parsing on the server side is not only hardcoded, but also happens before ModInitializers are called. Therefore a custom GeneratorType wouldn’t have been registered yet and couldn’t possibly be parsed. This could be fixed by accessing the serverPropertiesLoader local in the server main after the ModInitializers have been called and then simply reparsing the world type.

Additional Nice-To-Haves

As already mentioned in #297, there are some nice-to-have features that may be out of scope.

  • Cycling through different world types is a pain. Would be nice to have an easier method to select the desired type than just clicking a button repeatedly
  • Changing the default world type. It’s a simple mixin into the MoreOptionsDialogand possibly more relevant to packs than mods and therefore possibly better suited to a separate mod.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
CheaterCodescommented, Jul 31, 2020

I think the correct solution is to just reparse the GeneratorOptions after ModInitializers have been called.

0reactions
apple502jcommented, Jul 3, 2022

Vanilla 1.19 provides this feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom - Minecraft Wiki - Fandom
Custom is a world type that allows users to change the generation of the Overworld, Nether, and End dimensions as well as the...
Read more >
Crafting Custom Worlds Tutorial: Part 1 - YouTube
This tutorial series will teach you how to craft your very own custom worlds - beginning with Dimensions and Dimension Types.
Read more >
tutorial:generator_types [Fabric Wiki]
Generator type is a wrapper around a chunk generator and shows up on the world ... Feel free to replace it with your...
Read more >
Custom world generation : r/Minecraft - Reddit
So a friend and I were thinking of starting a vanilla wild west themed world, with only desert and mesa biomes and their...
Read more >
Minecraft Customized World Preset Generator
This feature is only available in Minecraft Java 1.12 and previous versions. Custom world aren't available for Minecraft Console and Bedrock Edition. Preset:....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found