mojira.dev
MC-309350

Shelf mushrooms generated with fallen trees replace water

Behavior:

When a fallen tree generates over water in the new dappled forest biome, if there are shelf mushrooms on that tree, the water source may be replaced.

Expected:

The shelf mushroom does not generate when in direct contact with water.

Seed: -3586500528061456650

TP: /execute in minecraft:overworld run tp @s -142.82 64.00 3595.39 76.35 46.20

Linked issues

Attachments

Comments 3

Thank you for helping us improve Minecraft! We saved your files:

[media][media]

It can be confirmed that the cause at the code level is as follows:

tryPlaceMushroomOnFallenTree.java snippet:

private static void tryPlaceMushroomOnFallenTree(Context context, BlockPos logPos, Direction facing, RandomSource random) {
    BlockPos mushroomPos = mushroomPosFor(logPos, facing);
    
    if (!context.isReplaceable(mushroomPos)) { //The issue lies here
        return;
    }
    //......
}

isReplaceable implementation:

the Context inner class in TreeDecorator.java:

public boolean isReplaceable(BlockPos pos) {
    return this.checkBlock(pos, BlockBehaviour.BlockStateBase::canBeReplaced);
}

Cases where canBeReplaced returns true in the game include water

Similarly, regular Poplar also has this issue

tryPlaceMushroomOnStandingTree snippet:

private static boolean tryPlaceMushroomOnStandingTree(Context context, BlockPos logPos, Direction facing, RandomSource random) {
    BlockPos mushroomPos = mushroomPosFor(logPos, facing);
    
    if (!context.isReplaceable(mushroomPos)) { //The issue lies here
        return false;
    }
    if (hasShelfMushroomAt(context, mushroomPos.below())) {
        return false;
    }
    placeMushroom(context, mushroomPos, facing, random);
    return true;
}

How to fix it:

Change “if (!context.isReplaceable(mushroomPos)) {“ to “if (!context.isAir(mushroomPos)) {“.isAir returns true only for air

But this leads to another issue. The ground in the Dappled Forest has a lot of Leaf Litter, which would greatly reduce the valid placement spots. Instead of changing it to isAir, we could add an extra water-specific check

This issue has been reviewed by our team.

Please add new, relevant information if it helps us understand or reproduce the issue. To show that you’re affected, use the vote feature rather than commenting.

If a fix is implemented, it will be listed in our official changelogs.

For major outages or urgent assistance, visit the Minecraft Help Center.

Slondo

(Unassigned)

1644123

Confirmed

Expansion A

Normal

World generation

26.3 Snapshot 1

26.3 Snapshot 3

Retrieved