capnkirok / animaniamod

Animania Mod
GNU Lesser General Public License v3.0
44 stars 38 forks source link

Allow easier compat in mod development #187

Closed Sunconure11 closed 5 years ago

Sunconure11 commented 6 years ago

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.

capnkirok commented 6 years ago

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.

Sunconure11 commented 6 years ago

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.

Tschipp commented 6 years ago

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

OreCruncher commented 6 years ago

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?

Tschipp commented 6 years ago

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

OreCruncher commented 6 years ago

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.

Tschipp commented 6 years ago

Yeah, we've had plans on making a maven but just haven't gotten around to do it. It is definitely planned though.

Tschipp commented 5 years ago

Going to close this, as it's not a real issue and it has been amended now