mojira.dev
MC-297837

Locator bar shows players above you as being below you when they are high enough

When looking straight downward and having a 2nd player above you, the player indicator can show them as being below you when they are high enough above you.

Keep an eye on the left player’s locator bar as the player on the right moves up and down:

[media]

Linked issues

Attachments

Comments 5

This bug will be within TrackedWaypoint#pitchDirectionToCamera implementations

Code analysis suggests that the bug exists within the azimuth distance waypoint implementation. Azimuth distance is used when WaypointTransmitter.isReallyFar is true, which is true when the distance is more then 332.0F blocks away

This appears to be WAI. At high distances where Azimuth is used to compute direction/distance, the only data that is given to clients by the server is the angle, hence azimuth.

So because of this limited data, Mojang opted to use the horizon angle to guess the pitch.

@Override
public TrackedWaypoint.PitchDirection pitchDirectionToCamera(Level level, TrackedWaypoint.Projector projector) {
	double horizonAngle = projector.projectHorizonToScreen();
	if (horizonAngle < -1.0) {
		return PitchDirection.DOWN;
	} else if (horizonAngle > 1.0) {
		return PitchDirection.UP;
	} else {
		return PitchDirection.NONE;
	}
}

The following is a snippet of code within LivingEntity#makeWaypointConnectionWith

if (WaypointTransmitter.isReallyFar(this, player) /* this.distanceTo(player) > 332f */) {
	return Optional.of(new WaypointTransmitter.EntityAzimuthConnection(this, icon, player));
} else if (!WaypointTransmitter.isChunkVisible(this.chunkPosition(), player)) {
    return Optional.of(new WaypointTransmitter.EntityChunkConnection(this, icon, player));
} else {
    Optional.of(new WaypointTransmitter.EntityBlockConnection(this, icon, player));
}

There may be a slight oversight in the code here, since the player and entity can be within the same chunk and should therefore use the EntityBlockConnection whilst also satisfying the isReallyFar check.

One way to fix this would be to modify isReallyFar to only take horizontal distance, not vertical.

Ray

(Unassigned)

1423805

Confirmed

Expansion A

(Unassigned)

25w20a, 25w21a, 1.21.6 Pre-Release 4

Retrieved