MC Modding
Please register and join the community!


Join the forum, it's quick and easy

MC Modding
Please register and join the community!
MC Modding
Would you like to react to this message? Create an account in a few clicks or log in to continue.

[Answered]Nether generation

3 posters

Go down

[Answered]Nether generation Empty [Answered]Nether generation

Post by the undecided t Fri Nov 04, 2011 2:22 am

Could someone please do a tutorial on how to make an ore that randomly generates only in the nether? That would be great and help me a ton.


Last edited by the undecided t on Sun Nov 06, 2011 7:09 am; edited 1 time in total
the undecided t
the undecided t
Helper

Posts : 45
Join date : 2011-10-20
Age : 28

http://www.blacklistgaming.org/forums

Back to top Go down

[Answered]Nether generation Empty Re: [Answered]Nether generation

Post by KiraBee Fri Nov 04, 2011 2:58 am

I think you just needs to be changed, "GenerateSurface" to "GenerateNether"

KiraBee
Member

Posts : 12
Join date : 2011-11-03
Age : 26
Location : Peru

Back to top Go down

[Answered]Nether generation Empty Re: [Answered]Nether generation

Post by the undecided t Sat Nov 05, 2011 5:57 pm

that didnt work...
the undecided t
the undecided t
Helper

Posts : 45
Join date : 2011-10-20
Age : 28

http://www.blacklistgaming.org/forums

Back to top Go down

[Answered]Nether generation Empty Re: [Answered]Nether generation

Post by thedirtyassassin Sat Nov 05, 2011 8:48 pm

This is what i want an answere too to Smile

thedirtyassassin
Member

Posts : 28
Join date : 2011-10-30
Location : In your dreams!

Back to top Go down

[Answered]Nether generation Empty Re: [Answered]Nether generation

Post by thedirtyassassin Sat Nov 05, 2011 9:32 pm

hey i think i got it

Save this as WorldGenNether.java

Code:

package net.minecraft.src;

import java.util.Random;

public class WorldGenNether extends WorldGenerator
{

    public WorldGenNether(int i, int j)
    {
        minableBlockId = i;
        numberOfBlocks = j;
    }

    public boolean generate(World world, Random random, int i, int j, int k)
    {
        float f = random.nextFloat() * 3.141593F;
        double d = (float)(i + 8) + (MathHelper.sin(f) * (float)numberOfBlocks) / 8F;
        double d1 = (float)(i + 8) - (MathHelper.sin(f) * (float)numberOfBlocks) / 8F;
        double d2 = (float)(k + 8) + (MathHelper.cos(f) * (float)numberOfBlocks) / 8F;
        double d3 = (float)(k + 8) - (MathHelper.cos(f) * (float)numberOfBlocks) / 8F;
        double d4 = (j + random.nextInt(3)) - 2;
        double d5 = (j + random.nextInt(3)) - 2;
        for(int l = 0; l <= numberOfBlocks; l++)
        {
            double d6 = d + ((d1 - d) * (double)l) / (double)numberOfBlocks;
            double d7 = d4 + ((d5 - d4) * (double)l) / (double)numberOfBlocks;
            double d8 = d2 + ((d3 - d2) * (double)l) / (double)numberOfBlocks;
            double d9 = (random.nextDouble() * (double)numberOfBlocks) / 16D;
            double d10 = (double)(MathHelper.sin(((float)l * 3.141593F) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D;
            double d11 = (double)(MathHelper.sin(((float)l * 3.141593F) / (float)numberOfBlocks) + 1.0F) * d9 + 1.0D;
            int i1 = MathHelper.floor_double(d6 - d10 / 2D);
            int j1 = MathHelper.floor_double(d7 - d11 / 2D);
            int k1 = MathHelper.floor_double(d8 - d10 / 2D);
            int l1 = MathHelper.floor_double(d6 + d10 / 2D);
            int i2 = MathHelper.floor_double(d7 + d11 / 2D);
            int j2 = MathHelper.floor_double(d8 + d10 / 2D);
            for(int k2 = i1; k2 <= l1; k2++)
            {
                double d12 = (((double)k2 + 0.5D) - d6) / (d10 / 2D);
                if(d12 * d12 >= 1.0D)
                {
                    continue;
                }
                for(int l2 = j1; l2 <= i2; l2++)
                {
                    double d13 = (((double)l2 + 0.5D) - d7) / (d11 / 2D);
                    if(d12 * d12 + d13 * d13 >= 1.0D)
                    {
                        continue;
                    }
                    for(int i3 = k1; i3 <= j2; i3++)
                    {
                        double d14 = (((double)i3 + 0.5D) - d8) / (d10 / 2D);
                        if(d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && world.getBlockId(k2, l2, i3) == Block.netherrack.blockID)
                        {
                            world.setBlock(k2, l2, i3, minableBlockId);
                        }
                    }

                }

            }

        }

        return true;
    }

    private int minableBlockId;
    private int numberOfBlocks;
}


And then in the mod_NameHere.java change:

Code:
 public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
     {
         for(int i = 0; i < 20; i++)
         {
             int randPosX = chunkX + rand.nextInt(16);
             int randPosY = rand.nextInt(120);
             int randPosZ = chunkZ + rand.nextInt(16);
             (new WorldGenMinable(mod_TheDirty.dirtyore.blockID, 30)).generate(world, rand, randPosX, randPosY, randPosZ);
         }
     }

to:
Code:
 public void GenerateNether(World world, Random random, int i, int j)
     {
         for(int 14 = 14;  < 20; 14++)
         {
             int j7 = i + random.nextInt(16);
             int k10 = random.nextInt(128);
             int j13 = j + random.nextInt(16);
             (new WorldGenNether(mod_NameHere.NameHere.blockID, 30)).generate(world, random, j7, k10, j13;
         }
     }

thedirtyassassin
Member

Posts : 28
Join date : 2011-10-30
Location : In your dreams!

Back to top Go down

[Answered]Nether generation Empty Re: [Answered]Nether generation

Post by the undecided t Sun Nov 06, 2011 7:09 am

thanks it worked great!
the undecided t
the undecided t
Helper

Posts : 45
Join date : 2011-10-20
Age : 28

http://www.blacklistgaming.org/forums

Back to top Go down

[Answered]Nether generation Empty Re: [Answered]Nether generation

Post by thedirtyassassin Sun Nov 06, 2011 4:56 pm

cool
no problem!
Glad i could help.

thedirtyassassin
Member

Posts : 28
Join date : 2011-10-30
Location : In your dreams!

Back to top Go down

[Answered]Nether generation Empty Re: [Answered]Nether generation

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum