Class WildAngerCheck<T extends Mob>
java.lang.Object
de.Keyle.MyPet.api.entity.leashing.WildAngerCheck<T>
- Type Parameters:
T- the Bukkit mob type this check applies to
Per-species predicate that decides whether a wild Bukkit mob is currently
"angry" — consumed by capture-time leash flags (see
AngryFlag).
Wraps the species-specific Bukkit API (e.g. Wolf#isAngry,
Bee#getAnger, Warden#getAngerLevel) so callers can ask
without an instanceof chain.
Declared as a static field on the matching PetXxx class:
public static final WildAngerCheck<Wolf> ANGER_CHECK =
new WildAngerCheck<>(Wolf.class, Wolf::isAngry);
Note the semantic inversion vs. other per-pet handles: this describes the wild mob's state before it becomes a pet, not the pet's own runtime state. The pet class is still the right declaration site because it is v4's single source of truth for everything species-specific.
Construction self-registers with WildAngerCheckRegistry; the
leash-flag check looks the entry up via
WildAngerCheckRegistry.forEntity(org.bukkit.entity.LivingEntity).
-
Constructor Summary
ConstructorsConstructorDescriptionWildAngerCheck(Class<T> mobClass, Predicate<T> predicate) Declares an anger check for one mob type, registering itself as it is built. -
Method Summary
Modifier and TypeMethodDescriptionmobClass()Returns the mob type this check applies to.booleantest(LivingEntity entity) Runs the check.
-
Constructor Details
-
WildAngerCheck
Declares an anger check for one mob type, registering itself as it is built.- Parameters:
mobClass- the Bukkit mob class this check applies topredicate- decides whether such a mob is currently angry
-
-
Method Details
-
mobClass
Returns the mob type this check applies to.- Returns:
- the Bukkit mob class
-
test
Runs the check. The entity must be an instance ofmobClass().- Parameters:
entity- the mob to test- Returns:
trueif the mob is currently angry
-