mojira.dev
MC-201351

End Crystals can't be placed underwater

The Bug
Despite water not destroying and End Crystal when underwater you can't place it

Replicate

  • Go Underwater

  • Place Bedrock/Obsidian

  • Attempt to place an End Crystal
    ❌ It doesn't get placed

Code Analysis
Code analysis by @unknown can be found in this comment.

Attachments

Comments 15

Can confirm in 21w03a.

Can confirm in 21w05b.

Can confirm in 21w06a.

Can confirm in 21w07a.

5 more comments

Can confirm in 1.18.2 and 22w11a. 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.item.EndCrystalItem.java

public class EndCrystalItem extends Item {
   ...
   public InteractionResult useOn(UseOnContext $uoc) {
      Level level = $uoc.getLevel();
      BlockPos blockpos = $uoc.getClickedPos();
      BlockState blockstate = level.getBlockState(blockpos);
      if (!blockstate.is(Blocks.OBSIDIAN) && !blockstate.is(Blocks.BEDROCK)) {
         return InteractionResult.FAIL;
      } else {
         BlockPos blockpos1 = blockpos.above();
         if (!level.isEmptyBlock(blockpos1)) {
            return InteractionResult.FAIL;
         } else {
            ...

If we look at the above class, we can see that the code specifically checks to see whether or not the block above the desired placing location is empty (is air), before being able to place down an end crystal. This is evident through the following line of code:

if (!level.isEmptyBlock(blockpos1))

Since water isn't air, the placement attempt fails, resulting in end crystals not being able to be placed underwater.

This ticket also relates to MC-222794.

Can confirm in 1.19.

Can confirm in 1.19.1.

Can confirm in 24w45a.

anthony cicinelli

(Unassigned)

Community Consensus

Items

end_crystal, placement-and-support

1.16.3, 1.16.4 Pre-release 1, 1.16.4 Pre-release 2, 1.16.4 Release Candidate 1, 1.16.4, ..., 23w16a, 1.20 Release Candidate 1, 1.20, 1.20.1, 1.20.4

Retrieved