Jump to content

Best way to add my new block type during world generation


Recommended Posts

Brand new to mod development, thanks for your patience. :)


I've managed to develop my new block type - a sort of glowing crystal, kind of like glowstone. I'm trying to figure out what is the best way to get the blocks to spawn during chunk generation. I've seen plenty of tutorials to get new ores to spawn, using WorldGenMinable(). I've been able to do that with no problem. The only thing is that function spawns the blocks in a typical ore vein pattern - contiguous groups of x blocks, generally arrayed 2 blocks wide. I've also stumbled on WorldGenBlockBlob(), which is neat, but also forms a standardized array (a layer of 9 or so blocks with a 1-block layer above it, etc).


I'd like my blocks to spawn in a different pattern, more like cactus - a single column of blocks. So what's the best way to achieve this? Should I override WorldGenCactus? Is there some function that spawns in a developer-assigned pattern?


I'm still finding my feet with mod development, but I'm learning a bunch. Thanks, all, for any pointers you can provide.

Link to comment
Share on other sites

I decided to just copy and modify the code from WorldGenCactus.class (which uses world.setBlock() for this purpose). It seems to work just fine. I'd still love to hear, though, what the best practice is for the general case of mimicking existing functionality.



Link to comment
Share on other sites

I think that is a legitimate way to do it.  Basically what you wanted was more like a structure or as you said the cactus.  If you think about it, world generation is a collection of quite different generations.  You generate bedrock, carve caves, contour the landscape, add plants, ores, villages.  Each is a very different algorithm of generation.  If you want something custom, then you would do it yourself.  There isn't (as far as I know) a generic "generate my pattern" method.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

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.

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

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