Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7388

Ignore spectator target in LivingEntity#getTargetEntity

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • None
    • None
    • 1.19.4, 1.20
    • Yes

      When calling PLAYER.getTargetEntity(32), if the PLAYER is in GameMode.SPECTATOR and his getSpectatorTarget() isn't null, the server just returns the spectator target entity instead of doing scan and returning the target entity that the entity the player is following is looking at.

      In other words, if PLAYER doesn't spectating ENTITY_1 and look at ENTITY_2 then PLAYER.getTargetEntity will return ENTITY_2. But if PLAYER is spectating ENTITY_1 and look at ENTITY_2 then PLAYER.getTargetEntity always return ENTITY_1.

      I think that the server need to check for spectator target before doing scan and if it isn't null, find the target using it. That is, if PLAYER is spectating ENTITY_1 and look at ENTITY_2 then PLAYER.getTargetEntity works the same way as ENTITY_1.getTargetEntity and return the correct target ENTITY_2.

      I will be very grateful if you fix this, because it bothers me quite a lot. Thanks for reading!

            Unassigned Unassigned
            molor Zhenya Zima
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: