So i'm trying to get the entity type that is being spawned by a mob spawner tile entity.
Using this will return the Bukkit entity type just fine:
However i'm unsuccessful with converting it to a skript entity type.
I have found this "method" (which doesn't feel like the right way), which returns the correct Skript entity type IF the name of the entity consists of only one word, otherwise it returns null:
So i'm wondering, what's the correct method to convert skript entity type to/from bukkit entity type?
Cheers
/edit:
Doing some messing around, this works, but it feels even more hacky and incorrect:
Using this will return the Bukkit entity type just fine:
Java:
BlockState state = block.getState();
CreatureSpawner spawner = (CreatureSpawner) state;
return spawner.getSpawnedType();
However i'm unsuccessful with converting it to a skript entity type.
I have found this "method" (which doesn't feel like the right way), which returns the correct Skript entity type IF the name of the entity consists of only one word, otherwise it returns null:
Java:
import ch.njol.skript.entity.EntityType;
BlockState state = block.getState();
CreatureSpawner spawner = (CreatureSpawner) state;
return EntityType.parse(spawner.getSpawnedType().toString());
So i'm wondering, what's the correct method to convert skript entity type to/from bukkit entity type?
Cheers
/edit:
Doing some messing around, this works, but it feels even more hacky and incorrect:
Java:
return EntityType.parse(spawner.getSpawnedType().toString().replace("_", " "));
Last edited: