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.
Related issues
is duplicated by
relates to
Attachments
Comments


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

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.

it is back in 1.8 i reported it, they took it down, even though it was updated

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 is intentional bug.

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.

There is no such thing as an intentional bug by definition.

This was fixed yet. I tried to make this but nothing happened

No, I can place yet

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)

confirmed for 1.15.2
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.
Can confirm in 20w48a.
Can confirm in 20w49a.
Can confirm in 21w03a.
Can confirm in 21w05a.
Can confirm in 21w05b.
Can confirm in 21w07a.
Can confirm in 21w08b.

Can confirm in 1.16.5

21w13a the error continues to happen in the latest version
Can confirm in 21w17a.

i can confirm still in 1.17
[media]
still possible 1.17 , when would it be fixed? But maybe its an new feature to make tunnels out of cane lol?
[media]
Can confirm in 1.17.1 Pre-release 2.

Can confirm in 1.17.1 Release Candidate 1.

Can confirm in 1.17.1 Release Candidate 2.

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 on Minecraft 1.18 Pre Release 6
Can confirm in 1.18.1.
Can confirm in 1.18.2.
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.

Affect 1.19 pre 3
Can confirm in 1.19.
Can confirm in 1.19.1.

In 1.19.2

In 1.19.3 Release Candidate 1
@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.

Сan confirm in 23w44a.

Is also present in 1.20.6 version