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

Hey guys,

ive a problem: My worldgen doesn't generate anything... I registred the worldgen like that: I really don't know what I'm doing wrong... Can you please look at the source code and can say me whats wrong? Probably I set an invalid if parameter?

 

Would be reeealy nice if you help me :)) Thanks, have a nice day :)

Legend

GameRegistry.registerWorldGenerator(new WorldGeneratorProjectRedExtended(), 0);

 

And here is the worldgenerator where i set how often the tree should be generated


if (bgb == BiomeGenBase.jungle || bgb == BiomeGenBase.jungleHills)
        {
            for (int i = 0; i < 6; i++)
            {
                int x = chunkX * 16 + random.nextInt(16) + 8;
                int y = random.nextInt(128);
                int z = chunkZ * 16 + random.nextInt(16) + 8;
                (new WorldGenRubberTree()).generate(world, random, x, y, z);
            }
        }

Here's the whole worldgen script:

package de.xthelegend.projectredextended;

import java.util.Random;

import codechicken.lib.vec.Vector3;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import de.xthelegend.projectredextended.lib.xawpnqf;
import de.xthelegend.projectredextended.lib.nawapsk;

public class WorldGenRubberTree extends WorldGenerator
{
    public void putLeaves(World var1, int x, int y, int z)
    {
        Block var5 = var1.getBlock(x, y, z);
        var1.setBlock(x, y, z, MainClass.BlockRubberLeaves);  
    }

    
    public boolean fillBlock(World var1, int x, int y, int z)
    {
        if (y >= 0 && y <= 126)
        {
            Block var5 = var1.getBlock(x, y, z);
            Block var6 = var5;/*Block.blocksList[var5];*/

            if (var6 != null && var6.isWood(var1, x, y, z))
            {
                return true;
            }
            else if (var6 != null && !var6.isLeaves(var1, x, y, z) && var5 != Blocks.tallgrass && var5 != Blocks.grass && var5 != Blocks.vine)
            {
                return false;
            }
            else
            {
                var1.setBlock(x, y, z, MainClass.BlockRubberWood);
                this.putLeaves(var1, x, y - 1, z);
                this.putLeaves(var1, x, y + 1, z);
                this.putLeaves(var1, x, y, z - 1);
                this.putLeaves(var1, x, y, z + 1);
                this.putLeaves(var1, x - 1, y, z);
                this.putLeaves(var1, x + 1, y, z);
                return true;
            }
        }
        else
        {
            return false;
        }
    }

    @Override
    public boolean generate(World var1, Random x, int y, int z, int var5)
    {
        int var9 = x.nextInt(6) + 25;

        if (z >= 1 && z + var9 + 2 <= var1.getHeight())
        {
            Block var6;
            int var7;
            int var8;

            for (var7 = -1; var7 <= 1; ++var7)
            {
                for (var8 = -1; var8 <= 1; ++var8)
                {
                    var6 = var1.getBlock(y + var7, z - 1, var5 + var8);

                    if (var6 != Blocks.grass && var6 != Blocks.dirt)
                    {
                        return false;
                    }
                }
            }

            byte var10 = 1;
            int var11;

            for (var11 = z; var11 < z + var9; ++var11)
            {
                if (var11 > z + 3)
                {
                    var10 = 5;
                }

                for (var7 = y - var10; var7 <= y + var10; ++var7)
                {
                    for (var8 = var5 - var10; var8 <= var5 + var10; ++var8)
                    {
                        var6 = var1.getBlock(var7, var11, var8);
                        Block var12 = var6; /*Block.blocksList[var6];*/

                        if (var12 != null && !var12.isLeaves(var1, var7, var11, var8) && !var12.isWood(var1, var7, var11, var8) && var6 != Blocks.tallgrass && var6 != Blocks.grass && var6 != Blocks.vine)
                        {
                            return false;
                        }
                    }
                }
            }

            for (var7 = -1; var7 <= 1; ++var7)
            {
                for (var8 = -1; var8 <= 1; ++var8)
                {
                    var1.setBlock(y + var7, z - 1, var5 + var8, Blocks.dirt);
                }
            }

            for (var11 = 0; var11 <= 6; ++var11)
            {
                for (var7 = -1; var7 <= 1; ++var7)
                {
                    for (var8 = -1; var8 <= 1; ++var8)
                    {
                        var1.setBlock(y + var7, z + var11, var5 + var8, MainClass.BlockRubberWood);
                    }
                }

                for (var7 = -1; var7 <= 1; ++var7)
                {
                    if (x.nextInt(5) == 1 && var1.getBlock(y + var7, z + var11, var5 - 2) == Blocks.air)
                    {
                    	var1.setBlock(y + var7, z + var11, var5 - 2, Blocks.vine);
                        var1.setBlockMetadataWithNotify(y + var7, z + var11, var5 - 2,  1, 0);
                    }

                    if (x.nextInt(5) == 1 && var1.getBlock(y + var7, z + var11, var5 + 2) == Blocks.air)
                    {
                    	var1.setBlock(y + var7, z + var11, var5 + 2, Blocks.vine);
                        var1.setBlockMetadataWithNotify(y + var7, z + var11, var5 + 2,  4, 0);
                    }
                }

                for (var8 = -1; var8 <= 1; ++var8)
                {
                    if (x.nextInt(5) == 1 && var1.getBlock(y - 2, z + var11, var5 + var8) == Blocks.air)
                    {
                    	var1.setBlock(y - 2, z + var11, var5 + var8, Blocks.vine);
                        var1.setBlockMetadataWithNotify(y - 2, z + var11, var5 + var8,  8, 0);
                    }

                    if (x.nextInt(5) == 1 && var1.getBlock(y + 2, z + var11, var5 + var8) == Blocks.air)
                    {
                    	var1.setBlock(y + 2, z + var11, var5 + var8, Blocks.vine);
                        var1.setBlockMetadataWithNotify(y + 2, z + var11, var5 + var8,  2, 0);
                    }
                }
            }

            Vector3 x3 = new Vector3();
            Vector3 x4 = new Vector3();
            int var14 = x.nextInt(100) + 10;
            int var17 = 0;

            while (var17 < var14)
            {
                x4.set((double)x.nextFloat() - 0.5D, (double)x.nextFloat(), (double)x.nextFloat() - 0.5D);
                x4.normalize();
                double var18 = ((double)var14 / 10.0D + 4.0D) * (double)(1.0F + 1.0F * x.nextFloat());
                x4.x *= var18;
                x4.z *= var18;
                x4.y = x4.y * (double)(var9 - 15) + (double)var14 / 10.0D;

                if (var14 < 
                {
                    switch (var14)
                    {
                        case 0:
                            x3.set((double)(y - 1), (double)(z + 6), (double)(var5 - 1));
                            break;

                        case 1:
                            x3.set((double)(y - 1), (double)(z + 6), (double)var5);
                            break;

                        case 2:
                            x3.set((double)(y - 1), (double)(z + 6), (double)(var5 + 1));
                            break;

                        case 3:
                            x3.set((double)y, (double)(z + 6), (double)(var5 + 1));
                            break;

                        case 4:
                            x3.set((double)(y + 1), (double)(z + 6), (double)(var5 + 1));
                            break;

                        case 5:
                            x3.set((double)(y + 1), (double)(z + 6), (double)var5);
                            break;

                        case 6:
                            x3.set((double)(y + 1), (double)(z + 6), (double)(var5 - 1));
                            break;

                        default:
                            x3.set((double)y, (double)(z + 6), (double)(var5 - 1));
                    }
                }
                else
                {
                    x3.set((double)(y + x.nextInt(3) - 1), (double)(z + 6), (double)(var5 + x.nextInt(3) - 1));
                }

                long x0 = x.nextLong();
                nawapsk var13 = new nawapsk(x3, x4, x0);

                while (true)
                {
                    if (var13.iterate())
                    {
                        Vector3 x2 = var13.get();

                        if (this.fillBlock(var1, (int)Math.floor(x2.x), (int)Math.floor(x2.y), (int)Math.floor(x2.z)))
                        {
                            continue;
                        }
                    }

                    ++var17;
                    break;
                }
            }

            return true;
        }
        else
        {
            return false;
        }
    }
}

I really dont know what im doing wrong :/ Please help me, im trying for 5 hours now.. And I dont get a solution :)

 

Guest
This topic is now closed to further replies.

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.