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

Tree generation in my biome keeps crashing. Tree Gen code is copied from the WorldGenTree class. Not sure what the problem is, any help appreciated.

 

Crash:

 net.minecraft.util.ReportedException: Ticking memory connection
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:60)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:674)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:570)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:127)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:468)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-04-27 09:20:34 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.world.biome.BiomeDecorator.decorate(BiomeDecorator.java:260)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.world.biome.BiomeDecorator.decorate(BiomeDecorator.java:203)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.world.biome.BiomeGenBase.decorate(BiomeGenBase.java:366)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.world.gen.ChunkProviderGenerate.populate(ChunkProviderGenerate.java:577)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:258)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1244)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:153)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.server.management.PlayerInstance.<init>(PlayerInstance.java:36)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.server.management.PlayerManager.getOrCreateChunkWatcher(PlayerManager.java:89)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.server.management.PlayerManager.updateMountedMovingPlayer(PlayerManager.java:248)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.server.management.ServerConfigurationManager.serverUpdateMountedMovingPlayer(ServerConfigurationManager.java:276)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.network.NetServerHandler.handleFlying(NetServerHandler.java:408)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.network.packet.Packet10Flying.processPacket(Packet10Flying.java:51)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:134)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:53)
2013-04-27 09:20:34 [iNFO] [sTDERR] 	... 6 more
2013-04-27 09:20:34 [sEVERE] [Minecraft-Server] Encountered an unexpected exception ReportedException
net.minecraft.util.ReportedException: Ticking memory connection
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:60)
at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:674)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:570)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:127)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:468)
at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
Caused by: java.lang.NullPointerException
at net.minecraft.world.biome.BiomeDecorator.decorate(BiomeDecorator.java:260)
at net.minecraft.world.biome.BiomeDecorator.decorate(BiomeDecorator.java:203)
at net.minecraft.world.biome.BiomeGenBase.decorate(BiomeGenBase.java:366)
at net.minecraft.world.gen.ChunkProviderGenerate.populate(ChunkProviderGenerate.java:577)
at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:258)
at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1244)
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:153)
at net.minecraft.server.management.PlayerInstance.<init>(PlayerInstance.java:36)
at net.minecraft.server.management.PlayerManager.getOrCreateChunkWatcher(PlayerManager.java:89)
at net.minecraft.server.management.PlayerManager.updateMountedMovingPlayer(PlayerManager.java:248)
at net.minecraft.server.management.ServerConfigurationManager.serverUpdateMountedMovingPlayer(ServerConfigurationManager.java:276)
at net.minecraft.network.NetServerHandler.handleFlying(NetServerHandler.java:408)
at net.minecraft.network.packet.Packet10Flying.processPacket(Packet10Flying.java:51)
at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:134)
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:53)
... 6 more

 

My WorldGenYellowTree code:

 

/** The minimum height of a generated tree. */
    private final int minTreeHeight;

    /** True if this tree should grow Vines. */
    private final boolean vinesGrow;

    /** The metadata value of the wood to use in tree generation. */
    private final int metaWood;

    /** The metadata value of the leaves to use in tree generation. */
    private final int metaLeaves;

    public WorldGenYellowTree(boolean par1)
    {
        this(par1, 4, 0, 0, false);
    }

    public WorldGenYellowTree(boolean par1, int par2, int par3, int par4, boolean par5)
    {
        super(par1);
        this.minTreeHeight = par2;
        this.metaWood = par3;
        this.metaLeaves = par4;
        this.vinesGrow = par5;
    }

    public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
    {
        int l = par2Random.nextInt(3) + this.minTreeHeight;
        boolean flag = true;

        if (par4 >= 1 && par4 + l + 1 <= 256)
        {
            int i1;
            byte b0;
            int j1;
            int k1;

            for (i1 = par4; i1 <= par4 + 1 + l; ++i1)
            {
                b0 = 1;

                if (i1 == par4)
                {
                    b0 = 0;
                }

                if (i1 >= par4 + 1 + l - 2)
                {
                    b0 = 2;
                }

                for (int l1 = par3 - b0; l1 <= par3 + b0 && flag; ++l1)
                {
                    for (j1 = par5 - b0; j1 <= par5 + b0 && flag; ++j1)
                    {
                        if (i1 >= 0 && i1 < 256)
                        {
                            k1 = par1World.getBlockId(l1, i1, j1);

                            Block block = Block.blocksList[k1];

                            if (k1 != 0 &&
                               !block.isLeaves(par1World, l1, i1, j1) &&
                                k1 != Block.grass.blockID &&
                                k1 != Block.dirt.blockID &&
                               !block.isWood(par1World, l1, i1, j1))
                            {
                                flag = false;
                            }
                        }
                        else
                        {
                            flag = false;
                        }
                    }
                }
            }

            if (!flag)
            {
                return false;
            }
            else
            {
                i1 = par1World.getBlockId(par3, par4 - 1, par5);
                Block soil = Block.blocksList[i1];
                boolean isSoil = (soil != null && soil.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (BlockSapling)Block.sapling));

                if (isSoil && par4 < 256 - l - 1)
                {
                    soil.onPlantGrow(par1World, par3, par4 - 1, par5, par3, par4, par5);
                    b0 = 3;
                    byte b1 = 0;
                    int i2;
                    int j2;
                    int k2;

                    for (j1 = par4 - b0 + l; j1 <= par4 + l; ++j1)
                    {
                        k1 = j1 - (par4 + l);
                        i2 = b1 + 1 - k1 / 2;

                        for (j2 = par3 - i2; j2 <= par3 + i2; ++j2)
                        {
                            k2 = j2 - par3;

                            for (int l2 = par5 - i2; l2 <= par5 + i2; ++l2)
                            {
                                int i3 = l2 - par5;

                                if (Math.abs(k2) != i2 || Math.abs(i3) != i2 || par2Random.nextInt(2) != 0 && k1 != 0)
                                {
                                    int j3 = par1World.getBlockId(j2, j1, l2);
                                    Block block = Block.blocksList[j3];

                                    if (block == null || block.canBeReplacedByLeaves(par1World, j2, j1, l2))
                                    {
                                        this.setBlockAndMetadata(par1World, j2, j1, l2, Main.yellowLeaves.blockID, this.metaLeaves);
                                    }
                                }
                            }
                        }
                    }

                    for (j1 = 0; j1 < l; ++j1)
                    {
                        k1 = par1World.getBlockId(par3, par4 + j1, par5);

                        Block block = Block.blocksList[k1];

                        if (k1 == 0 || block == null || block.isLeaves(par1World, par3, par4 + j1, par5))
                        {
                            this.setBlockAndMetadata(par1World, par3, par4 + j1, par5, Block.wood.blockID, this.metaWood);

                            if (this.vinesGrow && j1 > 0)
                            {
                                if (par2Random.nextInt(3) > 0 && par1World.isAirBlock(par3 - 1, par4 + j1, par5))
                                {
                                    this.setBlockAndMetadata(par1World, par3 - 1, par4 + j1, par5, Block.vine.blockID, ;
                                }

                                if (par2Random.nextInt(3) > 0 && par1World.isAirBlock(par3 + 1, par4 + j1, par5))
                                {
                                    this.setBlockAndMetadata(par1World, par3 + 1, par4 + j1, par5, Block.vine.blockID, 2);
                                }

                                if (par2Random.nextInt(3) > 0 && par1World.isAirBlock(par3, par4 + j1, par5 - 1))
                                {
                                    this.setBlockAndMetadata(par1World, par3, par4 + j1, par5 - 1, Block.vine.blockID, 1);
                                }

                                if (par2Random.nextInt(3) > 0 && par1World.isAirBlock(par3, par4 + j1, par5 + 1))
                                {
                                    this.setBlockAndMetadata(par1World, par3, par4 + j1, par5 + 1, Block.vine.blockID, 4);
                                }
                            }
                        }
                    }

                    if (this.vinesGrow)
                    {
                        for (j1 = par4 - 3 + l; j1 <= par4 + l; ++j1)
                        {
                            k1 = j1 - (par4 + l);
                            i2 = 2 - k1 / 2;

                            for (j2 = par3 - i2; j2 <= par3 + i2; ++j2)
                            {
                                for (k2 = par5 - i2; k2 <= par5 + i2; ++k2)
                                {
                                    Block block = Block.blocksList[par1World.getBlockId(j2, j1, k2)];
                                    if (block != null && block.isLeaves(par1World, j2, j1, k2))
                                    {
                                        if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2 - 1, j1, k2) == 0)
                                        {
                                            this.growVines(par1World, j2 - 1, j1, k2, ;
                                        }

                                        if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2 + 1, j1, k2) == 0)
                                        {
                                            this.growVines(par1World, j2 + 1, j1, k2, 2);
                                        }

                                        if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2, j1, k2 - 1) == 0)
                                        {
                                            this.growVines(par1World, j2, j1, k2 - 1, 1);
                                        }

                                        if (par2Random.nextInt(4) == 0 && par1World.getBlockId(j2, j1, k2 + 1) == 0)
                                        {
                                            this.growVines(par1World, j2, j1, k2 + 1, 4);
                                        }
                                    }
                                }
                            }
                        }

                        if (par2Random.nextInt(5) == 0 && l > 5)
                        {
                            for (j1 = 0; j1 < 2; ++j1)
                            {
                                for (k1 = 0; k1 < 4; ++k1)
                                {
                                    if (par2Random.nextInt(4 - j1) == 0)
                                    {
                                        i2 = par2Random.nextInt(3);
                                        this.setBlockAndMetadata(par1World, par3 + Direction.offsetX[Direction.rotateOpposite[k1]], par4 + l - 5 + j1, par5 + Direction.offsetZ[Direction.rotateOpposite[k1]], Block.cocoaPlant.blockID, i2 << 2 | k1);
                                    }
                                }
                            }
                        }
                    }

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

    /**
     * Grows vines downward from the given block for a given length. Args: World, x, starty, z, vine-length
     */
    private void growVines(World par1World, int par2, int par3, int par4, int par5)
    {
        this.setBlockAndMetadata(par1World, par2, par3, par4, Block.vine.blockID, par5);
        int i1 = 4;

        while (true)
        {
            --par3;

            if (par1World.getBlockId(par2, par3, par4) != 0 || i1 <= 0)
            {
                return;
            }

            this.setBlockAndMetadata(par1World, par2, par3, par4, Block.vine.blockID, par5);
            --i1;
        }
    }

 

BiomeGenAutumnForest:

/** The tree generator. */
    public WorldGenYellowTree worldGeneratorYellowTrees;
    public WorldGenOrangeTree worldGeneratorOrangeTrees;

public BiomeGenAutumnForest(int id) {
	super(id);
	this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 5,
			4, 4));
	this.theBiomeDecorator.treesPerChunk = 10;
	this.theBiomeDecorator.grassPerChunk = 2;

}

public WorldGenerator getRandomWorldGenForTrees(Random par1Random) {
	return (WorldGenerator) (par1Random.nextInt(5) == 0 ? this.worldGeneratorForest
			: (par1Random.nextInt(10) == 0 ? this.worldGeneratorYellowTrees
					: this.worldGeneratorOrangeTrees));
}

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.