Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

Posted

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

  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.

  • Author
  On 1/11/2023 at 10:49 AM, 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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.