[SPIGOT-7079] Allays don't call EntityTargetEvent on ground items Created: 24/Jun/22  Updated: 25/Dec/24  Resolved: 16/Aug/22

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

Type: Bug Priority: Minor
Reporter: Coral_Papa Assignee: Doc
Resolution: Fixed Votes: 0
Labels: None
Environment:

N/a


Issue Links:
Relates
relates to SPIGOT-7112 Mobs Added 1.17 and After Do Not Crea... Resolved
Version: 3539-Spigot-56be6a8-82f7574 (MC: 1.19) (Implementing API version 1.19-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

Allays don't call EntityTargetEvent when targeting items to pick up

    @EventHandler
    public void ontarger(EntityTargetEvent event) {
        
        Entity entity = event.getEntity();
        Entity target = event.getTarget();
        
        if(entity == null || target == null) return;
        
        Bukkit.broadcastMessage(entity.getType().name() + " " + target.getType().name());
        
    } 

I am trying to prevent Allays from picking up certain items.
canceling EntityPickupItemEvent just freezes them to that item and they don't loose focus of it.
so my only other option is to prevent Targeting the item.
This is when i noticed that it doesn't call the event.



 Comments   
Comment by Coral_Papa [ 25/Jun/22 ]

sorry about that, updated version and retested same results

Comment by Doc [ 24/Jun/22 ]

The version provided its not Spigot/CraftBukkit.

 

About EntityTargetEvent maybe can check for the missings cases.. and about EntityPickupItemEventy can make another PR for this case maybe a "cooldown" for make the allay forget this item in a few ticks...

Generated at Wed Apr 02 10:20:38 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.