Jump to content

Recommended Posts

Posted

So I have a structure that I am generating, but it is too common. Changing the "chunkX * 16, chunkZ * 16" to "chunkX * 128, chunkZ * 128" makes it rarer but also generates super super slowly.

 

      @Override
        public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
        {
            switch (world.provider.dimensionId)
            {
            case -1:
                generateNether(world, random, chunkX * 16, chunkZ * 16);
            case 0:
                generateSurface(world, random, chunkX * 16, chunkZ * 16);
            case 1:
                generateEnd(world, random, chunkX * 16, chunkZ * 16);
            }
        }
        
        
        private void generateEnd(World world, Random random, int x, int z)
        {
     
        }
     
        private void generateSurface(World world, Random random, int x, int z)
        {
       
        }
        
        private void generateNether(World world, Random random, int x, int z)
        {
        	//Nethengeic Pit Coords//
            int Xcoord = x + random.nextInt(16);
            int Ycoord = 25 + random.nextInt(35);
            int Zcoord = z + random.nextInt(16);
        
            (new NetherTower()).generate(world, random, Xcoord, Ycoord, Zcoord);

Posted

Just use the random function to reduce the chance, IE:

if(Random.nextInt(5) == 1){
//Generation code
}

This will effectively make it 1/5 as common. (Just change the 5 into whatever you want the denominator of the chance fraction to be)

This is actually what I ended up doing yesterday. Thanks for the tip.

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.