Jump to content

Generating a custom block randomly throughout the world


Melflex

Recommended Posts

Hi

I have been trying to write my first mod I am using forge 1.15.2 - 31.1.49, I started off with something basic, a new block type and then added drops and custom items (tools and armor) made from the new block and this all works.

I would like to finish the mod off by making the new block type appear naturally in the world, I have found a few references to IWorldGenerator although most of these were for 1.12 and these don't seem to carry over nicely.

Is this still the right way to go about it or is there a better way? If there is some documentation or examples of how this works for 1.15.2 that someone can point me to it would be most appreciated thank-you. I looked at Hardores mod but I was unsure if this would be the same for a custom block.

Link to comment
Share on other sites

You want Features, there's a DefaultBiomeFeatures class that has methods creating things like ore generation, flowers, trees, etc. and it is great for examples. net.minecraft.world.biome is the package the class is in.

 

You could probably get away with using one of the vanilla features and configuring it with your block, or you could get fancy and create/register your own subclass of Feature and build it yourself.

 

*edit: When looking for info, if it says 1.12 or lower, odds are good that most, if not all, of it has changed for 1.15. Here's a useful link for much of what's changed (there's a link in there too for 1.15 specific stuff, 1.13+ was the big overhaul of much of how things worked, that's why 1.12 guides aren't so good anymore)

https://gist.github.com/williewillus/353c872bcf1a6ace9921189f6100d09a

Edited by Ugdhar
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.

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...

×   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.

Announcements



×
×
  • Create New...

Important Information

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