[SPIGOT-6231] LivingEntity#getTargetBlock doesn't properly respect y-level Created: 09/Nov/20  Updated: 09/Nov/20  Resolved: 09/Nov/20

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: JRoy Assignee: Unassigned
Resolution: Invalid Votes: 0
Labels: api
Environment:

N/A but;
Windows 10
Java 8


Version: Built from latest (bc6a175eff672c6c1ca469211dffd61f124fa6a3)
Plugin: Not causing it but example used EssentialsX
Guidelines Read: Yes

 Description   

Using LivingEntity#getTargetBlock doesn't actually get the player's target block if they're looking at a lower y-level than their head is at. 

Here's an example with Essentials's /editsign command which uses getTargetBlock(null, 5) to detect the target block



 Comments   
Comment by Black Hole [ 09/Nov/20 ]

getTargetBlock() handles all blocks as if they're using their full block space.
To take the real block shapes into account you have to use getTargetBlockExact​()

Generated at Sat Apr 05 09:38:08 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.