Package de.Keyle.MyPet.api.goal
Class PetGoalRetentionRegistry
java.lang.Object
de.Keyle.MyPet.api.goal.PetGoalRetentionRegistry
Central registry of every
PetGoalRetention declared as a static
field on a pet class. Populated as a side effect of each declaration's
constructor, which fires during the pet class's <clinit>.
goalNamesFor(Pet) returns the union of every vanilla goal-key
name registered for the pet's type. PetGoalInstaller consults this
at spawn time — if the set is empty (no retention declared), it falls back
to the default removeAllGoals(mob) behavior; otherwise it iterates
the live mob's goals and removes only those whose key isn't in the set.
Adding a new retention is a one-line PetGoalRetention static
field on the relevant PetXxx class.
ensurePetsLoaded() force-initializes every registered pet
class via Class.forName(true) so the registry is fully populated
before the first spawn-side iteration. Same shape as the other
pet-class registries in this package family.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidForce-initializes every registered pet class viaClass.forName(true)so each one's staticPetGoalRetentionfield initializers fire and register with this registry.goalNamesFor(Pet pet) Returns the union of every vanilla goal-key name registered forpet's type.
-
Method Details
-
ensurePetsLoaded
public static void ensurePetsLoaded()Force-initializes every registered pet class viaClass.forName(true)so each one's staticPetGoalRetentionfield initializers fire and register with this registry. Idempotent; runs once per JVM. -
goalNamesFor
Returns the union of every vanilla goal-key name registered forpet's type. Empty set when no retentions are declared.- Parameters:
pet- the pet whose type to look up- Returns:
- the goal keys to keep on that pet's mob
-