Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[1.16.3] [Solved] Own Chunk Generator and Biome Generator with java code

Featured Replies

Posted

Hello there!

Today I decided to get into minecraft modding once more, as game development bored me a bit.

So, as the title already suggests, I want to somehow integrate own code into the json-data-driven system that minecraft

currently uses for its biome and terrain generation.

 

I'm totally clueless at the moment, as I have no idea how I can achieve something like this.

 

For the biome generator, I need to know how a codec works.

 

And for the terrain generator, I don't even know from what classes to extend from.

 

So, I'd really appreciate help.

 

-Budschie

  • Author

So, because I am getting no replies to this topic, I am a bit worried as this could mean that

this simply isn't possible. Could it be worth to backport my mod to 1.15, so that I can hardcode my dimensions again?

Chunk generators can be declared within json, biome generators are chunk generators. If something can be jsoned, it can most definitely be coded. Getting no replies to the topic either means that the person who viewed means they most like don't know the answer.

  • Author

@ChampionAsh5357Thanks for your quick reply! So, how do I register a biome/chunkgenerator? Do I just have to register it with a deferred registry? And how exactly should I handle the codec class, and what is its purpose?

17 hours ago, Budschie said:

So, how do I register a biome/chunkgenerator?

Biomes are handled through forge registries while chunk generators are handled through vanilla registries. You can find examples of both within the source or the docs.

17 hours ago, Budschie said:

And how exactly should I handle the codec class, and what is its purpose?

The codec class is essentially a generic algorithm that is not applicable to any one format. This allows different file operations to call this codec to handle in their specific file format. Here's a basic explanation of how to set up a codec. This article is completely independent of Forge itself and is not written by Forge.

  • Author

@ChampionAsh5357 Thanks again for the reply. So, I'm now slowly getting used to this stuff.

But as my old code used quite a few methods in a mod-own biome base class (it contained stuff like biome-specific chunk generation),

which inherited from biome (sadly, this behaviour isn't possible anymore, as the biome constructor is private),

I started to wonder whether it would be considered good practise to use access transformers to allow me to inherit from the biome class again.

 

So, I'd appreciate answers to this question.

-Budschie

Edited by Budschie

5 hours ago, Budschie said:

I started to wonder whether it would be considered good practise to use access transformers to allow me to inherit from the biome class again.

No, that wouldn't be feasible as this data driven system gets more developed over time. It would be just as easy to store a simple key interface that executes when a player is within a biome as needed without having to AT to extend the biome class.

  • Author

@ChampionAsh5357 Thanks for the reply 🙂 So, I have one last question:

I don't fully understand what you mean by:

13 hours ago, ChampionAsh5357 said:

a simple key interface

So, answers would be appreciated.

-Budschie

I should've put the word map in there. Basically, each biome has an associated registry key which is universally unique. You could grab the registry key of the specific object and pass that into a map to grab an associated object or interface which would allow you to do some custom mechanics for the biomes. It works the same as if it was attached to the object itself, minus a little extra time.

  • Budschie changed the title to [1.16.3] [Solved] Own Chunk Generator and Biome Generator with java code

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.