Posted October 23, 20159 yr So I want to remove some spawns but would like to do it with a loop instead of hard-coding every entity. So I'd like to loop through all the entities and remove the spawns. But my difficulty is in getting a list of all registered entities (vanilla and other mods). I think EntityList is only for vanilla entities now (and any mods that still use global ids). But it seems that the list for mod entities is kept in a private map called entityRegistrations in EntityRegistry class. I can use reflection I guess but I like to know if there is a more proper way to get the list of all registered entities. Anyone know? After looking at it I think I actually should approach this the other way around: instead of cycling through entities, instead cycle through all biomes and creature types? Seems that those have public methods and fields I can work with... But I still am interested in the general answer -- is there a public way to get list of all registered mod entities? Check out my tutorials here: http://jabelarminecraft.blogspot.com/
October 23, 20159 yr Any mod entity will have been registered with EntityRegistry#registerModEntity which adds entries to both EntityList.classToStringMapping and EntityList.stringToClassMapping; the first has class to "mod_id.entity_name" mappings, and the other has "mod_id.entity_name" to class mappings, so you can find it either with a name comparison or checking if the map contains the entity's class, depending on the actual implementation of whatever you are doing. The EntityList should also contain all vanilla entities, as far as I understand it. http://i.imgur.com/NdrFdld.png[/img]
October 23, 20159 yr Author Hmmm. You're right. For some reason I was looking at the code and thinking EntityRegistry was contained within itself. But you're right it also uses EntityList. EntityList also directly registers all the vanilla entities so I guess that is what got me thinking in the wrong path. Anyway, yes it looks like the mappings are public so I can iterate through them. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.