Code:
import:
org.bukkit.inventory.meta.BlockStateMeta
org.bukkit.entity.EntityType
org.bukkit.block.CreatureSpawner
org.bukkit.inventory.ItemStack
function spawner(entity: string) :: item:
set {_enum} to try {EntityType}.valueOf({_entity}.toUpperCase())
set {_spawner} to mob spawner
set {_spawner} to {_spawner}.getRandom()
set {_blockStateMeta} to {_spawner}.getItemMeta() as {BlockStateMeta}
set {_creatureSpawner} to {_blockStateMeta}.getBlockState() as {CreatureSpawner}
{_creatureSpawner}.setSpawnedType({_enum})
{_blockStateMeta}.setBlockState({_creatureSpawner})
set {_spawner} to {_spawner} as {ItemStack}
{_spawner}.setItemMeta({_blockStateMeta})
return {_spawner}
Error in:
Code:
[20:36:34] [Server thread/INFO]: [Skript] Reloading spawner.sk...
[20:36:34] [Server thread/ERROR]: Can't understand this expression: '{_spawner}.getItemMeta() as {BlockStateMeta}' (spawner.sk, line 11: set {_blockStateMeta} to {_spawner}.getItemMeta() as {BlockStateMeta}')
[20:36:34] [Server thread/ERROR]: Can't understand this expression: '{_blockStateMeta}.getBlockState() as {CreatureSpawner}' (spawner.sk, line 12: set {_creatureSpawner} to {_blockStateMeta}.getBlockState() as {CreatureSpawner}')
[20:36:34] [Server thread/ERROR]: Can't understand this expression: '{_spawner} as {ItemStack}' (spawner.sk, line 15: set {_spawner} to {_spawner} as {ItemStack}')
[20:36:34] [Server thread/INFO]: [Skript] Encountered 3 errors while reloading spawner.sk!
Skript ver: 2.4.1
Server ver: 1.15.2
sk-mirror: 2.0.0
How can i fix?
[doublepost=1585432868,1585417145][/doublepost]up!