mojira.dev
MC-267290

Markers and display entities obstruct placement of armor stands and end crystals

The bug

You can't place armor stands or end crystals if a marker or display entity occupies the block. This bug relates to MC-267260.

Steps to reproduce

  1. Place a block of obsidian.

  2. Run one of these commands on the block:

    summon marker ~ ~0.1 ~

    or

    summon block_display ~ ~0.1 ~
  3. Try to place an armor stand or end crystal on top of the block.

Observed result

The armor stand / end crystal can't be placed on top of the block.

Expected result

The armor stand / end crystal can be placed on top of the block because markers and display entities also don't obstruct the placement of blocks.

Code analysis

The code for placing armor stands and end crystals both use EntityGetter.getEntities(Entity, AABB) which supplies the default entity predicate EntitySelector.NO_SPECTATORS. This entity predicate only accounts for spectators and not for markers or display entities. Therefore if a marker or display entity is in the provided bounding box, it causes the check to fail.

net.minecraft.world.item.ArmorStandItem

public InteractionResult useOn(UseOnContext context) {
    // ...
    if (!level.noCollision(null, boundingBox) || !level.getEntities(null, boundingBox).isEmpty()) {
        return InteractionResult.FAIL;
    }
    // ...
}

net.minecraft.world.item.EndCrystalItem

public InteractionResult useOn(UseOnContext context) {
    // ...
    List<Entity> entities = level.getEntities(null, new AABB(x, y, z, x + 1, y + 1, z + 1));
    if (!entities.isEmpty()) {
        return InteractionResult.FAIL;
    }
    // ...
}

net.minecraft.world.level.EntityGetter

public List<Entity> getEntities(Entity exclude, AABB boundingBox) {
    return getEntities(exclude, boundingBox, EntitySelector.NO_SPECTATORS);
}

net.minecraft.world.entity.EntitySelector

public static final Predicate<Entity> NO_SPECTATORS = e -> !e.isSpectator();

Potential fix

Replace the default entity predicate for EntityGetter.getEntities(Entity, AABB) with one that also accounts for markers and display entities.

Linked issues

Comments 4

Thank you for your report!
We're tracking this issue in MC-89178, so this ticket is being resolved and linked as a duplicate.

If you would like to add a vote and any extra information to the main ticket it would be appreciated.

If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
-- I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.

This is not quite a duplicate because MC-89178 is about all entities, which is not too important, but this issue is specifically for markers and display entities, which is important because markers and display entities should not have any game play relevant impact.

This is part of that issue, it's included in it, which makes it a duplicate.

Rob23

(Unassigned)

Unconfirmed

(Unassigned)

Entities

1.20.4

Retrieved