is there a way i can get an items DataTag?
like this Spawner eggs {EntityTag:{id:“Creeper”}}
Sponge uses the Data API for this. In this case, you probably want itemStack.get(Keys.SPAWNABLE_ENTITY_TYPE).get()
. Be aware that if the item isn’t a spawn egg, the final .get()
call will throw an exception.
@JBYoshi Keys.SPAWNABLE_ENTITY_TYPE
was designed before eggs used NBT and so only supports EntityType
. So it’ll work fine for Sponge 4.1.0, but probably not for 1.9 (unless MC has built in checks for setting the item damage in 1.9)