mojira.dev
MC-264176

The predicate "looking_at" does not work as expected

Description

I encountered unexpected behavior when testing the "looking_at" predicate using the command /execute if predicate test:test (with the attached map with datapack). 

Observed behavior

  • If I could see the target entity’s eyes (the EyePos point, not the eye on the texture), even if I was looking at the entity through a solid block, the “look_at” test passed (IMG1).

  • However, if I couldn’t see the entity’s eyes, even if I was looking at the entity, the test failed (IMG2).

Expected behavior

The "look_at" test should only pass when the player directly looks at the target entity without obstructions.

Steps to reproduce

  1. Download the attached map with datapack.

  2. Launch the game and play the map.

  3. Execute /execute if predicate test:test in the above situations.

Additional information

The bug might affect all versions since "look_at" is added to the game (Tested on 1.20.1).
I believe this issue may be related to how Minecraft determines whether an entity is visible (not blocked by blocks, etc.). Minecraft’s raycast can only detect one type of collision (entity or block) at a time. So, the game must first run an entity collision test and then a block collision test, which uses a strange method to detect blocks (it simply detects block collisions on the line between the player’s eye position and the target entity’s eye position!

[media]

Linked issues

Attachments

Comments 2

(Going off the screenshots shown) The blue line is not the eye point used to calculate if the entity has visibility to you. The entity and player must both be able to see the red lines shown on the entity hitbox, as that is the true 'eye level' / point of visibility for an entity. That's why the test shown in IMG2 failed.

Thank you for your report!
We're tracking this issue in MC-226487, 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.

growuphappily

(Unassigned)

Unconfirmed

(Unassigned)

1.20.1

Retrieved