Disable "infernal" feature for some mobs by another mod.
NightKosh opened this issue ยท 5 comments
Hello. I'm looking for a compatibility feature. I need a way to prevent some of my mobs(from my mod) to become infernal directly from my mod. Is it possible?
I'm asked about this because there are few specific mobs in my mod which can spawn at another hostile mobs death and at some blocks destruction(like a silverfish, but in a huge amount). I think it is not fair for players and would like to disable "infernal" features for them.
Hi, any mob class that is encountered by Infernal Mobs for the first time is auto-entered into the config file and "whitelisted". All you have to do is edit the file and disable your mod entities. You can also distribute a premade config file with your mod entities blacklisted like that.
Yes, I know about it. But I'd like to be able to do it directly through my mod, so all other users should not even think about it. It is not possible to do at the moment, isn't it?
Well, if you are a modder yourself, sure it is possible. See https://github.com/AtomicStryker/atomicstrykers-minecraft-mods/blob/1.12.2/InfernalMobs/src/main/java/atomicstryker/infernalmobs/common/InfernalMobsCore.java#L99 for where Infernal Mobs keeps the configuration buffered as HashMap<String, Boolean>. You can use reflection to edit this map as you please ingame, yes even from your mod.
Ok. It should be enough for me. Thank you a lot!
P.S. it would be great if you add an API for it in the feature(for sure if you'll have time and desire). Or at least some another way. Reflection is a some kind of "dirty hack" for compatibility tasks.