The Bug:
Sugar cane can be placed underwater.
If there is water adjacent to and below the desired location of placement, sugar cane can be placed. This of course results in sugar cane being allowed to be placed underwater.
Steps to Reproduce:
Obtain some sugar cane and locate an open body of water.
Attempt to place sugar cane on any block underwater that has water adjacent to and below it.
Take note as to whether or not sugar cane can be placed underwater.
Observed Behavior:
Sugar cane can be placed underwater.
Expected Behavior:
Sugar cane would not be able to be placed underwater.
Code Analysis:
Code analysis by @unknown can be found in this comment.
Linked issues
is duplicated by 219
relates to 2
Attachments
Comments 46
Agreed with Tristan.
This isn't a bug. This has been like this since Alpha. At least it was like this when I started in Alpha 1.2.
Sugar Cane can be placed under water on multiplayer but not single player in the newest snapshot.
Ask for re-open Bug Report, since water-logged blocks are now possible and sugarcanes still do that air
Affected in minecraft snapshot 19w09a
@unknown, see MC-125351.
Weird sugarcane underwater is probably one of those "intentional bugs".
Known for years, never bothered to fix.
This isn't a bug, and the wiki just tells you that sugarcane can leave airpockets underwater which some people might interpret as the wiki saying that "it's a feature" which it clearly isn't because IT'S AN ALPHA OLD ALPHA BUG, ALPHA IS ALPHA.
Even if it is an Alpha feature why is it listed as a block that's bugged in water in MC-125351, and why is Mojang trying to remove blocks that leave airpockets underwater in Java and Bedrock if it is somekind of "feature".
See MC-125351 just as Asteraoth said. This isn't an intentional bug.
Which is the difference in put a sugar cane in the water on a superflat world and a normal world??
there should be no difference. Make sure you put the sugar cane on allowed blocks (dirt, grass, sand)
Hello @unknown! There's actually no need to confirm something in a version that is not the latest version or the latest snapshot. Adding those versions to reports is something that is not helpful to Mojang in fixing the bug, and adding outdated versions is not actually possible to do without special permissions on the tracker as far as I'm aware.
still possible 1.17 , when would it be fixed? But maybe its an new feature to make tunnels out of cane lol?
[media]Let me add. this works with lava (if there is water in an adjacent block that is one lower that the place you are trying to place the sugar cane on.
Also if the water is replaced by sugar cane placed using the same bug, the top sugar cane will pop off, on a block update or random tick.
Can confirm in 1.18.2 and 22w16b. Here's a code analysis of this issue.
Code Analysis:
The following is based on a decompiled version of Minecraft 1.18.2 using MCP-Reborn.
net.minecraft.world.level.block.SugarCaneBlock.java
public class SugarCaneBlock extends Block {
...
public boolean canSurvive(BlockState $bs, LevelReader $lr, BlockPos $bp) {
BlockState blockstate = $lr.getBlockState($bp.below());
if (blockstate.is(this)) {
return true;
} else {
if (blockstate.is(BlockTags.DIRT) || blockstate.is(Blocks.SAND) || blockstate.is(Blocks.RED_SAND)) {
BlockPos blockpos = $bp.below();
for(Direction direction : Direction.Plane.HORIZONTAL) {
BlockState blockstate1 = $lr.getBlockState(blockpos.relative(direction));
FluidState fluidstate = $lr.getFluidState(blockpos.relative(direction));
if (fluidstate.is(FluidTags.WATER) || blockstate1.is(Blocks.FROSTED_ICE)) {
return true;
}
}
}
return false;
}
}
...
If we look at the above class, we can see that the code only checks to see whether or not the block adjacent to and below the desired placing location is water or frosted ice, before being able to place down some sugar cane. This is evident through the following line of code:
if (fluidstate.is(FluidTags.WATER) || blockstate1.is(Blocks.FROSTED_ICE))
Since no checks are carried out to see if the sugar cane is underwater or in lava before being placed, this results in this problem occurring.
@unknown, 1.19.3 Release Candidate 1 is an archived affect version and cannot be added to this report. We can only update reports with the latest snapshot or release of the game as of the current moment in time. As of the present moment, 1.19.2 and 1.19.3 Release Candidate 3 can only be added. 🙂
I've just tested this problem now in 1.19.3-rc3 and the bug is still present so I've added this as an affected version. Just thought I'd let you know. 🙂
As this has been long-standing behavior, we have decided that if we fix this, it will be as part of a design change instead of as a bug fix. If we address this issue, it will be on a different work track.
This is how it works normally. This isn't a bug.
"When used underwater, sugar cane displaces the water, just as slabs do, leaving an air pocket."
-http://www.minecraftwiki.net/wiki/Sugar_Cane