[SPIGOT-7956] New method Entity#getDropMaterial() Created: 12/Nov/24  Updated: 25/Dec/24

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

Type: New Feature Priority: Minor
Reporter: Shane Bee Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Version: n/a
Guidelines Read: Yes

 Description   

I would like to suggest the addition of a method Entity#getDropMaterial
This would return the material (item) that represents this entity.

Examples:
ArmorStand -> Material.ARMOR_STAND
OakBoat -> Material.OAK_BOAT

NMS AbstractBoat has a method #getDropItem
I've seen a few people make comments it would be nice if Bukkit had something like this for boats.
I figured it would be nice to have a method in Entity (which for most would just return null, or maybe AIR?!?!?) and other entity classes which have an associated item (ie: armor stands, boats) would return said material.

I could do a PR for this, but I figured I'd see if its wanted before I put the work into it.



 Comments   
Comment by Shane Bee [ 14/Nov/24 ]

I think having a Vehicle method instead as you stated would be a better idea.

Comment by Doc [ 14/Nov/24 ]

The method called in NMS its just for Vehicles, where is hardcoded what need to be droped when the vehicle is destroy. the ArmorStand manage this in another way (the method called when PLAYER destroy the Entity)

 

But i not sure for what reasons the people wanna know the item used when is destroyed.. but maybe can be good include this in the Bukkit Vehicle interface.

Comment by FreeSoccerHDX [ 13/Nov/24 ]

Adding such a Method could confuse ppl if they think thats the loottable.

What about adding the loot table for those entities too ?
since the NMS-ArmorStand has the Method getLootTable and it should return the items i guess

Generated at Tue Apr 15 09:10:37 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.