Biomes O' Plenty

Biomes O' Plenty

151M Downloads

Redwood saplings do not grow

wwrpg opened this issue ยท 2 comments

commented

var12 when set very rarely will equal one of the valid block IDs. No reason to have this check as it will always return false during runtime. Recommend removing it to allow Redwoods to grow from saplings.

commented

#165 and this issue are duplicates.

Not sure of best fix, but the 5x5 grid check seems to be the problem where var12 runs into something (leaves, grass, dirt, other redwood, or 0) every time. To me it makes sense that the Redwood would just bust through any other barriers as long as there is enough light. This is probably what most people struggle with when growing the Redwood sapling.

In the Code below, var7 is set to false, even in cleared out areas where nothing appears above... the var12 == 0 when I debug it. Is air == 0???

        for (var8 = par4; var8 <= par4 + 1 + var6; ++var8)
        {
            var9 = 5;

            if (var8 == par4)
            {
                var9 = 5;
            }

            if (var8 >= par4 + 1 + var6 - 2)
            {
                var9 = 6;
            }

            for (int var10 = par3 - var9; var10 <= par3 + var9 && var7; ++var10)
            {
                for (var11 = par5 - var9; var11 <= par5 + var9 && var7; ++var11)
                {
                    if (var8 >= 0 && var8 < 256)
                    {
                        var12 = par1World.getBlockId(var10, var8, var11);

                        if (var12 != 0 && var12 != Blocks.leavesColorized1.get().blockID && var12 != Block.grass.blockID && var12 != Block.dirt.blockID && var12 != Blocks.logs3.get().blockID)
                        {
                            var7 = false;
                        }
                    }
                    else
                    {
                        var7 = false;
                    }
                }
            }
        }
commented

Closing this as you addressed it with your PR (For the 1.6.4 version that is, 1.7 already had it fixed since i redid a chunk of the code for redwoods).