Allow easier compat in mod development
Sunconure11 opened this issue · 8 comments
This mod has a stupidly large amount of classes, for each breed, including for both sexes of said breed, and the babies. Would it be possible to add some way of allowing mods to pick up on your mobs in a much, much easier way? It is incredibly tedious to hunt down all of the class names, for starters. I.e what if we want to have something target your goats as a whole, for instance, but can't be assed to hunt down every single class name and support it.
Well, you didn't put it very nicely, but it's hard to disagree. We would have to do a pretty big re-factoring. But we'll discuss.
Alright so I may get back with you regarding some cross-mod compat. Let's just say a project of mine is going a bit more public on the 31st.
This issue was created as a result of frustration from the class hell.
Right, so you’re somewhat right. However, all animals share certain things, all goats extend EntityAnimaniaGoat, cows extend EntityAnimaniaCow and so on. Additionally, all Animania animals implement IAnimaniaAnimal, and many other interfaces that define their behavior. I suggest looking through the 'com.animania.common.entities.interfaces' folder. In there you can find all available interfaces and use those for narrowing down your search.
If you want to check for a specific animal breed, you can do things like
if(entity instanceof EntityAnimaniaCow && ((EntityAnimaniaCow)entity).cowType == CowType.ANGUS)
to check for only angus cows
Touching on this a bit I noticed that the JAR now on CurseForge has different interfaces for Animania mobs than the prior release (which had the support hell that Suncore11 was referring to). Is this correct?
Yes, I added a ton of new interfaces that are used to describe the animals. You can find those interfaces here: https://github.com/capnkirok/animaniamod/tree/1.12/src/main/java/com/animania/common/entities/interfaces
A recommendation I have is to put those interfaces in a separate API JAR. As it stands I have to include the entirety of the Animania JAR in my build tree to reference the interfaces. Would be more efficient to have just an API jar that can either be checked into my build tree or pulled from a maven repo.
Yeah, we've had plans on making a maven but just haven't gotten around to do it. It is definitely planned though.