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.

Featured Replies

Posted

Hey Guys,

 

i'm new to Minecraft Forge Developing and work on my first project.

 

I already created my first custom biome and now i want to create my own world type(?).

I want to choose my custom world type when creating a new world instead of the default or amplified (...) types.

 

I already created my world type, but it doesn't appear at the world creation. I think I have register it, but I don't know how.

 

Do you have any hints for me? Or are there any Tutorials that I didn't found?

 

public class ApocalypseWorldType extends WorldType {

public static final WorldType APOCALYPSE = (new ApocalypseWorldType());

public ApocalypseWorldType()
{
	super("Apocalypse");
}


@Override
    public BiomeProvider getBiomeProvider(World world){
        return new ApocalypseBiomeProvider(world.getWorldInfo());
    }
    
    @Override
    public IChunkGenerator getChunkGenerator(World world, String generatorOptions){
        return new ApocalypseChunkProvider(world, world.getWorldInfo().isMapFeaturesEnabled(), world.getSeed());
    }
[...]
}

The

WorldType

constructor automatically inserts the

WorldType

into the

WorldType.WORLD_TYPES

array (used by the GUI).

 

Are you ever referencing the

ApocalypseWorldType

class anywhere to allow it to be loaded?

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

  • Author

Hi,

sorry for my late answer. I had no time to write an answer at this thread while I was at Gamescom this weekend.

And thanks for the information that the WorldType is added at the constructor.

 

Till now I only call the constructor in my custom WorldType class:

public static final WorldType APOCALYPSE = (new ApocalypseWorldType());

But I think this is not what you meant.

 

After your post I made the really dumb try to create an "alias" for my WorldType at my main class.

I know that this isn't a good style, I just wanted to know if it works.

public static final WorldType APOCALYPSE = ApocalypseWorldType.APOCALYPSE;

 

PS: I forgot to mention in my first post, that i am working with the recommended forge version (12.18.1.2011) for minecraft 1.10.2

You should create and store the instance in a separate class in preInit instead of in the class itself.

 

Java doesn't load a class and run its static field initialisers until it's referenced somewhere. With your current code, the instance will never be created and inserted into the array until the

ApocalypseWorldType

class is referenced.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.