mojira.dev
MC-10176

Oak/Dark Oak Tree Branches can replace all solid blocks (including Bedrock and Barrier)

To reproduce:

1 Build "tube" of any solid block as high as you want, with "open edges"

2 Plant sapling and grow it with bone meal.

3 Remove leaves to see, where wood replaced the solid blocks of the tube.

I suppose the kind of the solid block does not matter.

Related issues

MC-39802 Dark oak saplings can break BEDROCK MC-39994 Roofed Oak Tree grwoth can destroy blocks under the saplings MC-40091 Dark Oak roots can break bedrock on top of the Nether (after enderpearling up there) MC-40289 Bed rock breaking MC-40408 Dark Oak Position Bug MC-40417 Replace Bedrock, "Brake" Bedrock, tree growing glitch MC-40849 Break Bedrock Using Dark Oak Saplings MC-42003 Trees (I think actual wood blocks not leaves) replace nether brick MC-42404 Glitch in Nether to get above the Bedrock ceiling MC-44478 Dark Oak Trees can replace unintended blocks (including bedrock) MC-44547 Tree branches' wood log blocks replace arbitrary blocks when generated MC-46749 Growing Dark oak brakes barrier below MC-49091 Dark Oak trees growing down can break Bedrock and Barrier blocks MC-50137 Bedrock can be broken by dark oak trees MC-63993 Sapling Bug. MC-72843 Dark Oak breaks through bedrock MC-75850 Leaves overwritting mushroom blocks

Attachments

Comments

migrated
[media][media][media][media][media][media][media][media][media][media]
migrated

Confirmed.

migrated

The branches can also destroy bedrock!

Voting/

migrated

Looks everytime like this with closed corners/edges.

bugi74

Two bugs in the play.

Reason 1
At least for big (oak) tree generation, the method that checks whether a line of blocks is ok for generation has half-a-block difference compared to the method that later places the blocks. Thus, with (un)suitable angles, the checker slips through the corner, while the placer ends up stepping through the solid block.

Fix 1
Add the missing +0.5D's on the two minor axis. Using MCP and own namings, but should be clear where it is.

WorldGenBigTree.checkBlockLine()

...
    currentSpot[largestEndDeltaAxis] = from[largestEndDeltaAxis] + blockStep;
    currentSpot[axis2] = MathHelper.floor_double((double) from[axis2] + (double) blockStep * axis2Step + 0.5D);
    currentSpot[axis3] = MathHelper.floor_double((double) from[axis3] + (double) blockStep * axis3Step + 0.5D);
    ...

This should prevent the replacement of solid blocks, but does not prevent branches coming through the corners. But that is the next part...

(Also, the placer algorithm has unnecessary floor and +0.5 for the main axis; the base values are always integers so adding 0.5 and the taking the floor of it leads to the same base values.)

Reason 2
The "line tracing" method used is one that will only visit one block along each block size step in a direction where the slope of the path is smallest. Thus, it will "slip" through block corners.

Here is the code for the current algorithm (including the fix 1 from above):

WorldGenBigTree.checkBlockLine()

...
        int endMainCoord = endDelta[largestEndDeltaAxis] + mainStep;
        int mainCoord = 0;
        for (mainCoord = 0; mainCoord != endMainCoord; mainCoord += mainStep) {
            currentSpot[largestEndDeltaAxis] = from[largestEndDeltaAxis] + mainCoord;
            currentSpot[axis2] = MathHelper.floor_double((double) from[axis2] + (double) mainCoord * axis2Step + 0.5D);
            currentSpot[axis3] = MathHelper.floor_double((double) from[axis3] + (double) mainCoord * axis3Step + 0.5D);
            int blockId = this.worldObj.getBlockId(currentSpot[0], currentSpot[1], currentSpot[2]);
            if (blockId != 0 && blockId != Block.leaves.blockID)
                break;
        }
        ...

Fix 2 - partial
Replace the foor loop and add the method:

...
        do {
            // Point of entering the block:
            currentSpot[largestEndDeltaAxis] = from[largestEndDeltaAxis] + mainCoord;
            //              start point          + travel so far         - half a step
            double minor2 = (from[axis2] + 0.5D) + mainCoord * axis2Step - 0.5 * axis2Step;
            double minor3 = (from[axis3] + 0.5D) + mainCoord * axis3Step - 0.5 * axis3Step;
            currentSpot[axis2] = MathHelper.floor_double(minor2);
            currentSpot[axis3] = MathHelper.floor_double(minor3);
            
            // At the end?
            if (currentSpot[0] == to[0] && currentSpot[1] == to[1] && currentSpot[2] == to[2])
                break;
            
            if (!blockIsOk(currentSpot[0], currentSpot[1], currentSpot[2]))
                break;
            
            // Check minor axis at the point of leaving the block:
            //       start point          + travel so far         + half a step
            //double newminor2 = (from[axis2] + 0.5D) + mainCoord * axis2Step + 0.5 * axis2Step;
            //double newminor3 = (from[axis3] + 0.5D) + mainCoord * axis3Step + 0.5 * axis3Step;
            double newMinor2 = minor2 + mainStep * axis2Step;
            double newMinor3 = minor3 + mainStep * axis3Step;
            
            boolean change2 = MathHelper.floor_double(newMinor2) != currentSpot[axis2];
            boolean change3 = MathHelper.floor_double(newMinor3) != currentSpot[axis3];
            if (change2 && change3) { // Need to step along both minor axis
                // TODO: resolve in which order they should be stepped.
                currentSpot[axis2] = MathHelper.floor_double(newMinor2);
                if (!blockIsOk(currentSpot[0], currentSpot[1], currentSpot[2]))
                    break;
                
                currentSpot[axis3] = MathHelper.floor_double(newMinor3);
                if (!blockIsOk(currentSpot[0], currentSpot[1], currentSpot[2]))
                    break;
            } else if (change2) { // Need to step along axis 2
                currentSpot[axis2] = MathHelper.floor_double(newMinor2);
                if (!blockIsOk(currentSpot[0], currentSpot[1], currentSpot[2]))
                    break;
            } else if (change3) { // Need to step along axis 3
                currentSpot[axis3] = MathHelper.floor_double(newMinor3);
                if (!blockIsOk(currentSpot[0], currentSpot[1], currentSpot[2]))
                    break;
            }
            
            mainCoord += 1;
        } while (true);
        ...

    private boolean blockIsOk(int x, int y, int z) {
        int blockId = this.worldObj.getBlockId(x, y, z);
        if (blockId != 0 && blockId != Block.leaves.blockID)
            return false;
        return true;
    }

The loop is not fully optimized, but that is actually a minor thing compared to the fact that both the original and fixed version use double-values with absolute coordinates. This is bad coding, able to cause some issue at extreme coordinates. The algorithm should work on relative values (i.e. tree root would be always at values 0,0,0), which the block read and write routines would use by first taking 'floor' and then add the offset coordinates as integers.

If interested in how it works, I found a page that explains it quite well, although the above version is organized ever so slightly differently, and is for 3D instead of just 2D. http://sinepost.wordpress.com/2012/05/24/drawing-in-a-straight-line/

There is also that minor TODO-point left, but that only causes almost completely imperceptible difference with the "correct" operation.

NOTE: the same fix should NOT be applied to the placeBlockLine() method, otherwise branches will look, uh, twisted?

Remaining 'issues'
Note, this will only prevent branches sticking through the shown open-corner cylinder shapes. Just like some screenshots show with closed-corner cylinders, with this fix it is still possible to have those leaves-only growths outside the cylinder. This is yet another bug in the check routine; it only checks that the trunk has space to grow, not that there is a way for leaves to grow. Alternately, the generator could be a bit smarter when placing the leaves, but then it still allows rather silly trees (just the trunk and leaves on top of it).

bugi74

Affects 13w09b.

migrated

Is this still a concern in the current Minecraft version? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

migrated

Still in 13w11a.

migrated

Still in 14w08a for dark oak

galaxy_2alex

I opened the issue for the public as this issue is basically public due to many well-known Youtubers know it and used it publicly in their videos.
This might help to get attention to this bug to get this fixed. Yes, it is a very useful bug, but this is not supposed to be working like this.

migrated

The same in Snapshot 14w10c

migrated

Bug also appears in 14w11b.

migrated

Confirmed for 1.7.6pre

migrated

confirmed for 14w30c

migrated

confirmed for 14w31a

migrated

I found it with Jungle trees in 14w32d

migrated

In my opinion, breaking bedrock should be implemented as a feature, since it adds gameplay. Literaly 50% of the nether is not accessible without breaking bedrock. And it would be "unfair " towards players who haven't broken through bedrock in their world before it gets fixed.

Torabi

I don't think there's any legitimate reason to break blocks that are specifically designed to not be broken by the player. Bedrock and Barriers are there to give server admins or map creators a way of walling off sections of the world. It hurts gameplay or servers if they can't rely on that.

But really, I hope this gets fixed because it can break redstone machinery, most particularly automatic tree farms. Having a tree destroy your pistons or dispensers is a real pain.

migrated

Affects 1.8.1, at least for dark oak.

pokechu22

This also occurs with 2x2 jungle trees if you have a 3 block padding.

██: bedrock
▒▒: any block on bottom layer; air on all others
▓▓: dirt/sapling/air depending on layer.

         
         
         
         
         
         
         
         
         
         

With this structure bedrock in the walls will be replaced by wood in some of the jungle tree branches.

migrated

Fixed in 1.8.2-pre4, possibly earlier.

migrated

Somehow, I dont think Mojang want to admit the version that has the bug fixed.

migrated

present in pre 1...

migrated

present in pre 2...

migrated

present in pre 3...
It was fixed in 1.8.2 PRE 4

kumasasa

@unknown, see at the top of this ticket, there is clearly written:

Status: Resolved
Resolution: Fixed
Fix Version/s: Minecraft 1.8.2-pre4

migrated

Sorry. It just didn't have the intermediate versions of the affects versions page and the comment confirming it had been fixed was:
Fixed in 1.8.2-pre4, possibly earlier.
Notice the 'possibly earlier'.

migrated

(Unassigned)

Confirmed

Snapshot 13w07a, Snapshot 13w09a, Snapshot 13w09b, Snapshot 13w11a, Minecraft 1.6.4, ..., Minecraft 14w34d, Minecraft 1.8, Minecraft 1.8.1-pre1, Minecraft 1.8.1-pre3, Minecraft 1.8.1

Minecraft 1.8.2-pre4

Retrieved