Posted August 17, 20169 yr 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()); } [...] }
August 17, 20169 yr 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.
August 21, 20169 yr 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
August 21, 20169 yr 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.