MSpace-Dev Posted November 19, 2019 Posted November 19, 2019 Is it possible to get all loaded entities in the registry (from all other mods) at runtime, to then be able to spawn in said entity within my mod? I feel it might be possible now, with how structured the registry events are in 1.14. I am also trying to generate new entities at runtime based on this by using a builder pattern of sorts. Quote
MSpace-Dev Posted November 19, 2019 Author Posted November 19, 2019 (edited) I've been doing some research. What are your thoughts on this method? @SubscribeEvent public static void onRegisterEntities(final RegistryEvent.Register<EntityType<?>> event) { DeferredWorkQueue.runLater(() -> { entityBuilder(event); }); } private static void entityBuilder(final RegistryEvent.Register<EntityType<?>> event) { ArrayList<EntityType<?>> all_entities; all_entities = (ArrayList<EntityType<?>>) event.getRegistry().getValues(); Main.LOGGER.debug("ALL LOADED ENTITIES:"); all_entities.forEach(p -> Main.LOGGER.debug(p)); } And will I be able to register new entities under new IDs using the methods within EntityType and ForgeRegistries.ENTITIES? (If I don't go with this method ^) Edited November 19, 2019 by MSpace-Dev Quote
MSpace-Dev Posted November 19, 2019 Author Posted November 19, 2019 Well, that actually does not run. DeferredWorkQueue#runLater does not get called. Quote
MSpace-Dev Posted November 19, 2019 Author Posted November 19, 2019 So, creating new entity types based on other mods is impossible? Quote
MSpace-Dev Posted November 19, 2019 Author Posted November 19, 2019 I want to expand my mod's features lots in 1.14.4. I want users to be able to specify mobIDs from other mods in JSON to initialise a new item, block and entity for the specified id. To do this, I need to be able to dynamically create these objects. It would be perfect for my mod. You will be able to see that at a quick glance I think: https://www.curseforge.com/minecraft/mc-mods/monster-totems Quote
MSpace-Dev Posted November 19, 2019 Author Posted November 19, 2019 How would I achieve something like that roughly? Any suggestions / resources I can look into? Quote
MSpace-Dev Posted November 19, 2019 Author Posted November 19, 2019 (edited) Ah, thanks. I will look into it further tomorrow morning. I have to head off to sleep, but hope I can get something working. Forge 1.14 is a rather large step in the right direction from what I've seen so far! Edited November 19, 2019 by MSpace-Dev Quote
Recommended Posts
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.