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 have a couple custom biomes with designated custom surface builders, although I don't know how to make the kind of biome surface builder I want. So what I am asking, is a walkthrough to how the default biome surface builder works, and how I can create my own to the type of biome I want, this is the default biome surface builder:

protected void buildSurface(Random random, IChunk chunkIn, Biome biomeIn, int x, int z, int startHeight, double noise, BlockState defaultBlock, BlockState defaultFluid, BlockState top, BlockState middle, BlockState bottom, int sealevel) {
   BlockState blockstate = top;
   BlockState blockstate1 = middle;
   BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable();
   int i = -1;
   int j = (int)(noise / 3.0D + 3.0D + random.nextDouble() * 0.25D);
   int k = x & 15;
   int l = z & 15;

   for(int i1 = startHeight; i1 >= 0; --i1) {
      blockpos$mutable.setPos(k, i1, l);
      BlockState blockstate2 = chunkIn.getBlockState(blockpos$mutable);
      if (blockstate2.isAir()) {
         i = -1;
      } else if (blockstate2.getBlock() == defaultBlock.getBlock()) {
         if (i == -1) {
            if (j <= 0) {
               blockstate = Blocks.AIR.getDefaultState();
               blockstate1 = defaultBlock;
            } else if (i1 >= sealevel - 4 && i1 <= sealevel + 1) {
               blockstate = top;
               blockstate1 = middle;
            }

            if (i1 < sealevel && (blockstate == null || blockstate.isAir())) {
               if (biomeIn.getTemperature(blockpos$mutable.setPos(x, i1, z)) < 0.15F) {
                  blockstate = Blocks.ICE.getDefaultState();
               } else {
                  blockstate = defaultFluid;
               }

               blockpos$mutable.setPos(k, i1, l);
            }

            i = j;
            if (i1 >= sealevel - 1) {
               chunkIn.setBlockState(blockpos$mutable, blockstate, false);
            } else if (i1 < sealevel - 7 - j) {
               blockstate = Blocks.AIR.getDefaultState();
               blockstate1 = defaultBlock;
               chunkIn.setBlockState(blockpos$mutable, bottom, false);
            } else {
               chunkIn.setBlockState(blockpos$mutable, blockstate1, false);
            }
         } else if (i > 0) {
            --i;
            chunkIn.setBlockState(blockpos$mutable, blockstate1, false);
            if (i == 0 && blockstate1.getBlock() == Blocks.SAND && j > 1) {
               i = random.nextInt(4) + Math.max(0, i1 - 63);
               blockstate1 = blockstate1.getBlock() == Blocks.RED_SAND ? Blocks.RED_SANDSTONE.getDefaultState() : Blocks.SANDSTONE.getDefaultState();
            }
         }
      }
   }

}

So if anyone could walk me through how this works, that would be amazing. Also if someone would tell me the math I would have to do to make a sahara surface builder, that would be awesome.

Well, I see a for loop that starts at a startHeight and if the block at that position is air, it (continues the loop and) goes down.

If the block is the same as defaultBlock, then it does some other stuff to determine what block to place at that position instead. i (but starts at -1, meaning the first block that isn't air does something different than if i > 0--set by j) and j are based on some noise values. i and the seaHeight determine what block is placed.

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.