In my mod, there is a certain TileEntity which contains a String that is the name of an EntityLiving. Is there a way to get the actual class of the entity from its name? For example, if the TileEntity contains the String "Blaze" I want to be able to spawn a blaze into the world somewhere. If there is no way to do this, is there a way to store the actual entity in NBT instead of just its name?
You can use EntityList.createEntityByName to create a new instance of an Entity by it's name (for a Blaze, this is just "Blaze", but have a look at the mappings added near the bottom of the class) and you can get the name of an entity using EntityList.getEntityString or EntityList.getEntityStringFromClass.
Thanks, I did some snooping but wasn't able to find the EntityList class before. I have one question however. There is no createEntityByName method, there is a createEntityByIDFromName method, but it requires a ResourceLocation. Would I just pass it a new ResourceLocation("Blaze") or whatever the entity I wanted to spawn is, or is it more complicated than that?
Ah sorry, I was looking at 1.10.2 code and didn't know it differs from 1.11.
After now looking through the EntityList class in 1.11.2, it looks like you can use a ResourceLocation with the name in all lowercase (since ResourceLocations have to be lowercase anyway) so just use "blaze". I've not tested this at all, but that should work.