Paper
Paper copied to clipboard
Ability to get entity data from spawner eggs and spawner block (and eventually other ItemMeta and BlockState containing entities/entity tags)
Is your feature request related to a problem?
I'm writing a plugin to scan my world for cheated/unusual stuff. I intend to scan everything, like blocks, entities, inventories,...
I try my best to look into entity/tileentity inventories, inventories in items (shulker box),...
I know that spawner blocks and spawner eggs can have custom nbt that would be copied into the spawned entity (like pre-filled custom name, inventory content,... ).
I'm not able to find API that provides the entity data (in SpawnEggMeta for the item meta of spawner eggs, and CreatureSpawner block state for the spawner block), except the EntityType.
Describe the solution you'd like.
- 1st idea: provide a method to get an instance of Entity that correspond to the type and data of the spawner, and is not actually spawned in the world (like if it was already dead or despawned instantly), so it is possible to use the bukkit entity api to access all the desired data.
- Another solution is to provide a method to actually trigger the spawning of the entity (this is the same as above, but we are not returning a dead/not-spawned entity instance). The plugin dev would also have the choice to kill/delete the entity or not, after.
- Alfway solution: the method would have a boolean parameter to determine if the entity is spawned into the world or not.
Describe alternatives you've considered.
- Access the nbt data directly
- don't scan my world that much, there is a low chance that someone thought about hiding a cheated item in a shulker-box inside a mule inventory that is stored in a spawner egg...
Other
In addition to solve the initial issue, the presented solution would also provide a way to programmatically spawn an entity based on a spawner egg item or a spawner block.
EDIT: it would also be nice to have this functionality extended for:
- Other items that spawn entities: ItemFrame (no specific ItemMeta interface), ArmorStand (
ArmorStandMeta) and Aquatic mob buckets (TropicalFishBucketMeta,AxolotlBucketMeta) that can all have a EntityTag tag in their NBT. - BlockState:
- Beehive (and possibly all
EntityBlockStorage) with the possibility to list the entities without having to release them (with releaseEntities() method)
- Beehive (and possibly all