Jump to content

[Solved] [1.18.2] Problems with HeightRangePlacement.triangle when doing ore generation


Recommended Posts

Posted (edited)

So, when I implemented ore generation for my mod, everything's working as expected, except, that my tin ore is a lot rarer than I intended. Not big issue, I thought, then proceeded to bump up the value for vein per chunk. To my surprise, that didn't help, no matter how absurd I altered the value to. But in the end of the day, the ore still generated, so I called it a day and continued working on other stuff.

Only today, when I was working on new ores, I discovered that the tin ores are generating in abundance down in y=-40. This made me slowly realise where the issue lie.

    public static final Holder<PlacedFeature> TIN_ORE_PLACED = PlacementUtils.register("tin_ore_placed",
            ModConfiguredFeatures.TIN_ORE, commonOrePlacement(32, 
                    HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-16), VerticalAnchor.aboveBottom(94))));

    public static final Holder<PlacedFeature> TIN_ORE_LARGE_PLACED = PlacementUtils.register("tin_ore_large_placed",
            ModConfiguredFeatures.TIN_ORE_LARGE, commonOrePlacement(16,
                    HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-16), VerticalAnchor.aboveBottom(94))));

Here in this section of my ModPlacedFeatured.java, I think I misunderstood the 'VerticalAnchor.aboveBottom' value, I thought it means my ore will only generate between y=-16 to y=94, and will be most commonly found in the y=39 region. However, it is evident that the tin ores are more commonly generated in y=-40 and below, despite the fact they shouldn't be there in the first place. 

In an attempt to un-mess up my mess up, I tried to look into what the VerticalAnchor value is for, and did a range of research online. I searched blindly for what I will not find.

This is my final desperate cry for help.

Edit: Changing the aboveBottom to absolute fixed it, huge thanks

Edited by RuthlessNail
Posted
Quote

VerticalAnchor.aboveBottom(-16)

So -16 blocks "above" the bottom of the world. Or in other words, in the void beneath the world. -64 - 16 = -80

Quote

VerticalAnchor.aboveBottom(94)

-64 + 94 = 30

Since it is a triangle, the peak will be at the middle of the range (30 - 80) / 2 = -25

 

Perhaps you meant to use VertialAnchor.absolute() ? Or -16 to 94 with a peak at (94 - 16) / 2 = 39

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Posted
10 minutes ago, warjort said:

So -16 blocks "above" the bottom of the world. Or in other words, in the void beneath the world. -64 - 16 = -80

-64 + 94 = 30

Since it is a triangle, the peak will be at the middle of the range (30 - 80) / 2 = -25

 

Perhaps you meant to use VertialAnchor.absolute() ? Or -16 to 94 with a peak at (94 - 16) / 2 = 39

Thanks mate, that makes total sense, I'll test it out right now and see if it works.

  • RuthlessNail changed the title to [Solved] [1.18.2] Problems with HeightRangePlacement.triangle when doing ore generation

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.