[SPIGOT-7487] entity.remove() on a leash drops a lead item Created: 21/Sep/23  Updated: 25/Dec/24  Resolved: 30/Nov/23

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

Type: Bug Priority: Minor
Reporter: Maxime Deraiche Jenkins Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: 1.20, bug, entity, spigot

Attachments: File LeashBug-1.0-SNAPSHOT.jar     PNG File image-2023-09-21-18-36-54-824.png    
Version: 3870-Spigot-d2eba2c-78796c9 (MC: 1.20.1)
Guidelines Read: Yes

 Description   

Whenever you call entity.remove() on a LeashHitch entity, a lead item is dropped at the entity's location.

I'm not sure if this is expected behavior, but when we do the same on a painting or an item frame, they do not drop anything.

entity.remove() should simply remove the entity without spawning any item.

 

I made a small plugin to test this out.
You can follow these steps:
1. attach lead to any entity
2. attach it to a fence
3. in survival mode, break the attached leash
4. a diamond and a lead will drop

another testing:

1. attach lead to any entity
2. attach it to a fence

3. right click on the leash with an empty hand

4. send a message in chat
5. the leash is broken and there's a new lead on the ground



 Comments   
Comment by Marvin Rieple [ 25/Nov/23 ]

Made a PR for this: craftbukkit#1304

You can test it with BuildTools:

java -jar BuildTools.jar --rev 3945 --pr craftbukkit:1304
Comment by Maxime Deraiche Jenkins [ 28/Sep/23 ]

I found a workaround, thanks to goldentoenail

It seems like it is the attached entity that is dropping the lead. So by using the EntityDropItemEvent, you can cancel the event and tada.

Generated at Thu Apr 03 15:54:51 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.