Jump to content

Recommended Posts

Posted

Hey guys, I've created a worldgen. That works fine:

new BlockDarkStoneGen(BlockDarkStone,0, random.nextInt(16)).generate(world, random, x, y, z);

 

But If I change the nextInt >16 ,Minecraft crashs If I want to create a new world. Can anybody help me

Posted

Here is the source code of BlockDarkStoneGen

 

package com.Santa.betterundergroundmod;

 

    protected int meta;

    protected int veinSize;

    protected Block block;

   

    public BlockDarkStoneGen(Block block, int meta, int veinSize)

    {

        this.block = block;

        this.meta = meta;

        this.veinSize = veinSize;

    }

 

    public void swapStoneBlock(World world, Random random, int x, int y, int z)

    {

        if (world.getBlock(x, y, z) == Blocks.stone)

            world.setBlock(x, y, z, block, meta, 2);

    }

 

    @Override

    public boolean generate(World world, Random random, int x, int y, int z)

    {

       

        float f = (float) (random.nextFloat() * Math.PI);

        double d0 = x + 8 + MathHelper.sin(f) * this.veinSize / 8.0F;

        double d1 = x + 8 - MathHelper.sin(f) * this.veinSize / 8.0F;

        double d2 = z + 8 + MathHelper.cos(f) * this.veinSize / 8.0F;

        double d3 = z + 8 - MathHelper.cos(f) * this.veinSize / 8.0F;

        double d4 = y + random.nextInt(3) - 2;

        double d5 = y + random.nextInt(3) - 2;

 

       

        for (int l = 0; l <= this.veinSize; l++)

        {

            double d6 = d0 + (d1 - d0) * l / this.veinSize;

            double d7 = d4 + (d5 - d4) * l / this.veinSize;

            double d8 = d2 + (d3 - d2) * l / this.veinSize;

            double d9 = random.nextDouble() * this.veinSize / 16.0D;

            double d10 = (MathHelper.sin(l * 3.141593F / this.veinSize) + 1.0F) * d9 + 1.0D;

            double d11 = (MathHelper.sin(l * 3.141593F / this.veinSize) + 1.0F) * d9 + 1.0D;

            int i1 = MathHelper.floor_double(d6 - d10 / 2.0D);

            int j1 = MathHelper.floor_double(d7 - d11 / 2.0D);

            int k1 = MathHelper.floor_double(d8 - d10 / 2.0D);

            int l1 = MathHelper.floor_double(d6 + d10 / 2.0D);

            int i2 = MathHelper.floor_double(d7 + d11 / 2.0D);

            int j2 = MathHelper.floor_double(d8 + d10 / 2.0D);

            for (int k2 = i1; k2 <= l1; k2++)

            {

                double d12 = (k2 + 0.5D - d6) / (d10 / 2.0D);

                if (d12 * d12 < 1.0D)

                    for (int l2 = j1; l2 <= i2; l2++)

                    {

                        double d13 = (l2 + 0.5D - d7) / (d11 / 2.0D);

                        if (d12 * d12 + d13 * d13 < 1.0D)

                            for (int i3 = k1; i3 <= j2; i3++)

                            {

                                double d14 = (i3 + 0.5D - d8) / (d10 / 2.0D);

                                if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D)

                                    swapStoneBlock(world, random, k2, l2, i3);

                            }

                    }

            }

        }

        return true;

    }

 

    protected static class Evaluation

    {

        final int x, y, z;

        int sides;

 

        public Evaluation(int x, int y, int z, int sides)

        {

            this.x = x;

            this.y = y;

            this.z = z;

            this.sides = sides;

        }

 

        public void evaluateSide()

        {

            sides--;

        }

 

        @Override

        public boolean equals(Object o)

        {

            if (o instanceof Evaluation)

            {

                Evaluation e = (Evaluation) o;

                return x == e.x && y == e.y && z == e.z && sides == e.sides;

            }

            return false;

        }

    }

 

}

 

and here is the crash report:

 

Location: World: (41744,20,-1347), Chunk: (at 0,1,13 in 2609,-85; contains blocks 41744,0,-1360 to 41759,255,-1345), Region: (81,-3; contains chunks 2592,-96 to 2623,-65, blocks 41472,0,-1536 to 41983,255,-1025)

 

-- Requested block coordinates --

Details:

Found chunk: true

Location: World: (41472,0,-1344), Chunk: (at 0,0,0 in 2592,-84; contains blocks 41472,0,-1344 to 41487,255,-1329), Region: (81,-3; contains chunks 2592,-96 to 2623,-65, blocks 41472,0,-1536 to 41983,255,-1025)

 

-- Requested block coordinates --

Details:

Found chunk: true

Location: World: (41392,46,-1666), Chunk: (at 0,2,14 in 2587,-105; contains blocks 41392,0,-1680 to 41407,255,-1665), Region: (80,-4; contains chunks 2560,-128 to 2591,-97, blocks 40960,0,-2048 to 41471,255,-1537)

 

-- Requested block coordinates --

Details:

Found chunk: true

Location: World: (41200,37,-1536), Chunk: (at 0,2,0 in 2575,-96; contains blocks 41200,0,-1536 to 41215,255,-1521), Region: (80,-3; contains chunks 2560,-96 to 2591,-65, blocks 40960,0,-1536 to 41471,255,-1025)

 

-- Requested block coordinates --

Details:

Found chunk: true

Location: World: (41056,0,-1792), Chunk: (at 0,0,0 in 2566,-112; contains blocks 41056,0,-1792 to 41071,255,-1777), Region: (80,-4; contains chunks 2560,-128 to 2591,-97, blocks 40960,0,-2048 to 41471,255,-1537)

 

There isn't more information.

Hope you can help me :)

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.