The bug
Red and brown mushrooms accept bone meal even on a block on which they cannot grow.
With the newly introduced fungi mechanics in 20w09a this does not seem intentional any longer. Mushrooms can only be grown into huge mushrooms when on dirt-based blocks.
Examples
Here are some examples in videos:
Code analysis
Code analysis by @unknown can be found in this comment.
Linked issues
relates to 1
Attachments
Comments 9
Can confirm in 22w18a. Here's a code analysis regarding this issue along with a fix.
Code Analysis:
The following is based on a decompiled version of Minecraft 1.19.2 using MCP-Reborn.
net.minecraft.world.level.block.MushroomBlock.java
public class MushroomBlock extends BushBlock implements BonemealableBlock {
...
public boolean isValidBonemealTarget(BlockGetter blockGetter, BlockPos blockPos, BlockState blockState, boolean b) {
return true;
}
...
f we look at the above class, we can see that the isValidBonemealTarget()
boolean always returns true
regardless of any circumstances. The game doesn't check if the block below a red or brown mushroom is included within the #minecraft:mushroom_grow_block block tag before allowing bone meal to be applied to the mushrooms, therefore resulting in this problem occurring.
Fix:
Simply altering the isValidBonemealTarget()
boolean to only return true
if the block below the given mushroom is included within the #minecraft:mushroom_grow_block block tag will resolve this problem.
Current Code:
...
return true;
...
Fixed Code:
...
BlockState blockstate = blockGetter.getBlockState(blockPos.below());
return blockstate.is(BlockTags.MUSHROOM_GROW_BLOCK);
...
This ticket relates to MC-239082
Following on from my code analysis, I've double-checked my proposed fix and I can confidently confirm that it's fully functioning and works as expected, so I've attached two screenshots to this report, one of which shows the current code and the other that shows the fixed code. I feel this information may be quite insightful hence my reasoning for providing it.
[media][media]
Can confirm in 21w05b.