Sponge
Sponge copied to clipboard
MobSpawnerData#possibleEntitiesToSpawn is empty
I am currently running
- SpongeForge version: stable-7
- Java version: 1.8.0_121
- Operating System: Windows 10
Issue Description
When getting the value of Keys.SPAWNER_ENTITIES
from a MobSpawner
TileEntity, which leads to MobSpawnerData#possibleEntitiesToSpawn
, the returned WeightedCollectionValue
is empty:
I tested it by spawning a Skeleton spawner via /setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Skeleton"}}
then checking it's data via event.getTargetBlock().getLocation().get().getTileEntity().get().get(Keys.SPAWNER_ENTITIES)
.
I searched a bit in MobSpawnerBaseLogic
and found that setting SpawnPotentials
instead of SpawnData
works fine:
/setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {SpawnPotentials:[{Entity:{id:"Skeleton"}}]}
The reason is that SpawnData
forces the entity to spawn if SpawnPotentials
is empty/unspecified, but since Sponge directly gets the potentialSpawns
field of the spawner logic (which is empty for spawners made with your command), then it will return an empty collection. Note that nextEntityToSpawn()
will still return the skeleton archetype.