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

Mobs Added 1.17 and After Do Not Create an EntityTargetEvent Properly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • None
    • None
    • Tested on the latest version of Vanilla Spigot, as well as some past major versions of Spigot Minecraft that I already had on my computer

    • CraftBukkit version 3552-Spigot-14a2382-fc30711 (MC: 1.19) (Implementing API version 1.19-R0.1-SNAPSHOT)
    • Yes

    Description

      I've been working with the EntityTargetEvent to run code when specific mobs try to target a player who has food in their hand. I have found that the EntityTargetEvent works as expected, except for mobs which have been added to Minecraft during and after version 1.17. In this case, the mobs will not create a targeting event and continue as normal, which stops me from modifying vanilla behavior. Other ways of targeting appear to work (EG: a goat targeting an entity to ram them). I have tested this in a few versions of Spigot and Minecraft and it seems to be occurring since Spigot builds for Minecraft 1.17.

       

      Me holding wheat and being targeted by a cow, sheep, and goat

       

      My console during this point in time - only the cow and sheep create an event not the goat

       

      From my testing, this occurs with every mob added during and after 1.17. that will follow a player because they are holding food. This includes axolotls, frogs, and goats.

      I also found the following from testing which I believe could also be part of this issue:

      • An event is not created for when Allays seek to track a player down and give them an item. 
      • An event is not created when a non-angered warden begins to follow a player. It is only created when they actively target the player to attack

       

      I have included a plugin that I created to test the range of this bug. It simply prints to the console when an entity attempts to target another entity.

      Attachments

        Issue Links

          Activity

            People

              Doc Doc
              RT5Phantom RT5Phantom
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: