mojira.dev
MC-98091

End crystals cannot be placed when any entity occupies the desired location of placement

The Bug:

End crystals cannot be placed when an entity occupies the desired placement location.

Steps to Reproduce:

  1. Place down some bedrock and throw an item on top of it.

  2. Obtain an end crystal and attempt to place in on the bedrock.

Observed Behavior:

End crystals cannot be placed.

Expected Behavior:

End crystals would be able to be placed.

Code Analysis:

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

Additional code analysis by @unknown can be found in this comment.

Linked issues

Attachments

Comments 23

Please link to this comment in the description

The following is based on a decompiled version of Minecraft 1.10 using MCP 9.30.

The reason for this is the same as for MC-89178, the affected method is net.minecraft.item.ItemEndCrystal.onItemUse(ItemStack, EntityPlayer, World, BlockPos, EnumHand, EnumFacing, float, float, float).

Confirmed for 1.13.1.

13 more comments

Can confirm in 21w41a. Just for clarification purposes, the word "drop" used throughout this report means "item entity".

I'd like to request ownership of this ticket since the current reporter has been inactive since March of 2019.

Can confirm in 1.18.2 and 22w11a. This issue is present with all entities that have no collision such as experience orbs, area effect clouds, etc... and isn't just exclusive to dropped items (item entities).

Here's a thorough code analysis of this issue. I'm aware that one has already been done by @unknown, however, I'd like to add some extra information to make it crystal clear as to why this issue occurs.

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 {
            double d0 = (double)blockpos1.getX();
            double d1 = (double)blockpos1.getY();
            double d2 = (double)blockpos1.getZ();
            List<Entity> list = level.getEntities((Entity)null, new AABB(d0, d1, d2, d0 + 1.0D, d1 + 2.0D, d2 + 1.0D));
            if (!list.isEmpty()) {
               return InteractionResult.FAIL;
            } else {
               ...

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

List<Entity> list = level.getEntities((Entity)null, new AABB(d0, d1, d2, d0 + 1.0D, d1 + 2.0D, d2 + 1.0D));
if (!list.isEmpty())

Since all entities with no collision such as dropped items, experience orbs, etc... are considered entities, the placement attempt fails, resulting in end crystals not being able to be placed when entities with no collision are present above the desired placing location.

Can confirm in 1.19.

Can confirm in 1.19.2.

Block twenty-eight

Avoma

(Unassigned)

Confirmed

Entities, Items

drop, ender_crystal, entity, item

Minecraft 1.9 Pre-Release 4, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.1, Minecraft 1.9.2, ..., 1.21.4, 25w08a, 1.21.5, 1.21.6, 1.21.7

Retrieved