[SPIGOT-5311] Add API to EntityProjectileThrowable setItem Created: 08/Sep/19  Updated: 01/Aug/23  Resolved: 20/Feb/20

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

Type: New Feature Priority: Minor
Reporter: crysis992 Assignee: Unassigned
Resolution: Fixed Votes: 6
Labels: None

Version: This server is running CraftBukkit version git-Spigot-065a373-9aa7430 (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

Since 1.14 projectiles like Snowball, Enderpeal, and Eggs extend the NMS class 'EntityProjectileThrowable'. This class has a method setItem which accepts an ItemStack to change the displayed / thrown item. This can be used to make any ItemStack throwable or used as a projectile.

 Example:

Snowball projectile = player.launchProjectile(Snowball.class);
((CraftSnowball) projectile).getHandle().setItem(CraftItemStack.asNMSCopy(new ItemStack(Material.CARROT)));

 

It would be great to get this implemented to the API with a setter and getter method.



 Comments   
Comment by Yolwoocle [ 01/Aug/23 ]

Is there still interest to add this into the API? This could be an interesting feature for some developers.

Comment by TheCreeperCow [ 10/Feb/20 ]

While i agree with this implementation is a bit difficult due to the fact the bukkit projectiles interface also holds things like fireballs and others that do not support this method 

Generated at Fri Mar 28 13:36:03 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.