GlutenTag Posted February 19, 2018 Posted February 19, 2018 Hello, I'm trying to make a mod that creates an additional world type. This additional world type is exactly the same as "Customized", except that all of the terrain generation variables are set to random values automatically so you jump into a very odd and entirely unexpected world each time. I've already found the ChunkGeneratorSettings class and the WorldType class, and I've got the basic outline of the mod started (Forge recognizes my mod exists but it does nothing yet, gotten via tutorial). I'm in an AP Computer Science class right now - third quarter - so I'm able to understand what most of the code is doing here. But this is a whole lot to take in at once and I don't know how to approach doing this or how to modify/override things inside a referenced library. Any help and suggestions is appreciated. Thanks! Quote
jabelar Posted February 19, 2018 Posted February 19, 2018 Honestly world generation is one of the more complicated parts of Minecraft. The code is pretty convoluted with providers, generators, decorators, world gen, map gen, structures and so forth. But since you're in formal programming courses that should help. I'm not sure why you say "modify/override things inside a referenced library". You shouldn't have to do anything like that with Forge. Forge already has "hooks" to modify the vanilla behavior. Basically to modify things I approach it as follows: 1) look for public fields and methods you can modify directly. Because Minecraft is not properly encapsulated there are a lot of things you can access directly. For example, entity AI is in a public list so you can literally just clear the list and recreate your own. 2) look for events. Most of the common things people want to mod now have an event that helps you intercept the vanilla behavior and even fully replace it with your own. For example, you can handle the DecorateBiomeEvent to change how flowers or trees are generated. 3) use Java reflection. Since Java allows it, if necessary you can use Reflection to change the access permissions of fields and methods and then make use of them. I've started making a tutorial on world generation, although I admit it is a work in progress and it also isn't meant to be customizable like what you want. But it should be useful to you as I discuss most of the major classes involved. You can see it here: http://jabelarminecraft.blogspot.com/p/minecraft-forge-1721710-biome-quick-tips.html However, after all that, what you are trying to do is probably fairly easy. I think you'd need to make a new WorldType so that would allow it to come up in the new world menu. Now it sounds like you don't really want to make it customizable but rather just random. So I think you can copy the customized dimension code but force the ChunkGeneratorSettings to have random values. 1 Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
Recommended Posts
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.