-
Bug
-
Resolution: Duplicate
-
None
-
1.20.4
-
Unconfirmed
-
(Unassigned)
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
- Place a block of obsidian.
- Run one of these commands on the block:
summon marker ~ ~0.1 ~
or
summon block_display ~ ~0.1 ~
- 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.
public InteractionResult useOn(UseOnContext context) { // ... if (!level.noCollision(null, boundingBox) || !level.getEntities(null, boundingBox).isEmpty()) { return InteractionResult.FAIL; } // ... }
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; } // ... }
public List<Entity> getEntities(Entity exclude, AABB boundingBox) { return getEntities(exclude, boundingBox, EntitySelector.NO_SPECTATORS); }
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.
- duplicates
-
MC-89178 Armor stands cannot be placed when any entity occupies the desired location of placement
- Reopened