mojira.dev
MC-267260

Display Entity can be pushed by placing Eye of Ender into End Portal Frame

If the Display Entity is in the Eye Hitbox in End Portal Frame, then they will be "pushed" out.

Detail Hitbox Range of the Eye part in End Portal Frame:
x,z in range of ~.25 to ~.75 (exclude boundary point)
y in range of ~.8125 to ~2 (exclude boundary point)

What I expected to happen:

Display Entity will stay on the position where they have been summoned to.

What actually happened:

Display Entity has been pushed to an upper location out of the Eye Hitbox.

How to reproduce:

  1. place a Command Block with following command and run it:

    execute align xyz run summon block_display ~.749 ~1.813 ~.749 {block_state:{Name:"grass_block"},transformation:{left_rotation:[0.0f,0.0f, 0.0f, 1.0f], translation: [0.0f, 0.0f, 0.0f], right_rotation: [0.0f, 0.0f, 0.0f, 1.0f], scale: [0.5f, 0.5f, 0.5f]},Tags:[test_bd]}
  1. place an End Portal Frame on top of the Command Block

  2. check where the entity is at with the following command:

    execute as @e[tag=test_bd] run data get entity @s Pos
  1. Place the Eye of Ender and check the position again with the same command in step 3.

Screenshots:

[media][media]

Attachments

Comments 6

I recon this also affects markers, and converting farmland to dirt

Just did a code analysis, here is a stack trace of where the problem seems to be coming from:

Block.pushEntitiesUp(...) (line 144)
EntityGetter.getEntities(Entity, AABB) (line 33)
Level.getEntities(Entity, AABB, Predicate) (line 676)
LevelEntityGetterAdapter.get(AABB, Consumer) (line 43)
EntitySectionStorage.getEntities(AABB, AbortableIterationConsumer) (line 122)
EntitySectionStorage.forEachAccessibleNonEmptySection(...) (line 65)
EntitySection.getEntities(AABB, AbortableIterationConsumer)

net.minecraft.world.level.entity.EntitySection

public Continuation getEntities(AABB boundingBox, AbortableIterationConsumer<T> consumer) {
    for (EntityAccess entity : storage) {
        if (entity.getBoundingBox().intersects(boundingBox) &&
            consumer.accept(entity).shouldAbort()) {
            return Continuation.ABORT;
        }
    }
    return Continuation.CONTINUE;
}

In the method EntitySection.getEntities(...) there is no check for whether the entity is a marker or display entity but only a check for the bounding box, where the empty bounding box of a marker or display entity seems to also be able to intersect with other bounding boxes. This also affects @e[dx=...,dy=...,dz=...] selectors in that they also pick up markers and display entities but I'm not sure whether that behavior should be changed or not.

 

Block.pushEntitiesUp(...) should have the entity type check to fix this (if anything else in that stack trace does, it's likely the solution gets unintentional side effects).

I rather think the default entity predicate used in EntityGetter.getEntities should be changed to accommodate for markers and display entities as it is also used in other places, e.g. to determine whether endermen can place blocks somewhere, whether an armor stand or end crystal can be placed and which entities are moved away from explosions (note: markers and display entities won't move away, only the Motion tag is changed).

SY91419

(Unassigned)

Community Consensus

Platform

Normal

Entities

1.20.4, 1.21.1, 24w35a, 1.21.3

Retrieved