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.

Featured Replies

Posted

I tried tracing the code but that went off the rails pretty quick.

what does topOffset do?
some samples from the minecraft code...
public static final ConfiguredFeature<?, ?> ORE_GRAVEL_NETHER = register("ore_gravel_nether", Feature.ORE.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NETHERRACK, Features.States.GRAVEL, 33)).withPlacement(Placement.RANGE.configure(new TopSolidRangeConfig(5, 0, 37))).square().func_242731_b(2));
   public static final ConfiguredFeature<?, ?> ORE_BLACKSTONE = register("ore_blackstone", Feature.ORE.withConfiguration(new OreFeatureConfig(OreFeatureConfig.FillerBlockType.NETHERRACK, Features.States.BLACKSTONE, 33)).withPlacement(Placement.RANGE.configure(new TopSolidRangeConfig(5, 10, 37))).square().func_242731_b(2));

the official minecraft wiki has this for the generation...

Veins of blackstone attempt to replace netherrack 2 times per chunk in veins of size 1 to 33, from levels 5 to 28, in all Nether biomes except basalt deltas.
Veins of gravel attempt to replace netherrack 2 times per chunk in veins of size 1–33, from levels 5 to 41, in all Nether biomes except basalt deltas.

So the times per chunk makes sense... EX[func_242731_b(2)]
The 33 makes sense... EX[33] easy enough.
TopSolidRangeConfig falls apart, a bit but then the site is based on 1.16.2 it seems.

So does this sound right?
(5, 0, 37) would be 5 to 37
(5, 10, 37) would be what 5 to 47... 15 to 47? ??

Edited by frakier

Hi

public class RangePlacement extends SimplePlacement<TopSolidRangeConfig> {
   public RangePlacement(Codec<TopSolidRangeConfig> codec) {
      super(codec);
   }

   public Stream<BlockPos> getPositions(Random random, TopSolidRangeConfig config, BlockPos pos) {
      int i = pos.getX();
      int j = pos.getZ();
      int k = random.nextInt(config.maximum - config.topOffset) + config.bottomOffset;
      return Stream.of(new BlockPos(i, k, j));
   }
}

 

Beats me why they found it necessary to have both config.maximum and config.topOffset in there.  Probably it means something, eg maximum is the highest y value of this feature but don't use the topmost topOffset rows.

 

TopSolidRangeConfig(int bottomOffset, int topOffset, int maximum)

means (5, 0, 37) gives you nextInt(37  - 0) + 5 = 5 to 41 inclusive

and (5,10, 37) gives you nextint(37 - 10) + 5 = 5 to 31 inclusive

 

-TGG

  • Author
On 12/21/2020 at 4:46 AM, TheGreyGhost said:

Beats me why they found it necessary to have both config.maximum and config.topOffset in there.  Probably it means something, eg maximum is the highest y value of this feature but don't use the topmost topOffset rows.


TopSolidRangeConfig(int bottomOffset, int topOffset, int maximum)

means (5, 0, 37) gives you nextInt(37  - 0) + 5 = 5 to 41 inclusive

and (5,10, 37) gives you nextint(37 - 10) + 5 = 5 to 31 inclusive

Could be. That makes sense compared with how they do do the range(32) which is basically 0-31.
I get a chance I will do some testing with some xray and see how different settings work out.
Figured I would see if someone knew the answer before I started too far down the rabbit hole.

Edited by frakier

  • 3 weeks later...

Did that testing, the conclusion was exactly what TGG said (well since he got it from the code that would be obvious lol):

// bottomOffset -> minimum height for the ore
// maximum -> minHeight + maximum = top level (the vertical expansion of the ore, it grows x levels from bottomOffset)
// topOffset -> subtracted from the maximum to give actual top level
// ore effectively exists from bottomOffset to (bottomOffset + maximum - topOffset)

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.