Contents
Class FlockMembershipSystems
java.lang.Object
com.hypixel.hytale.server.flock.FlockMembershipSystems
A class that contains a variety of flock-related systems for managing flock membership.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA ref system that handles entities being added to or removed from the store with aFlockMembershipcomponent.static classAn entity ticking system that handles filtering damage received by a player from flock membersstatic classA holder system that handles NPCs added from world generation with aFlockMembershipcomponent.static classA damage event system that handles entities with aFlockMembershipcomponent dealing damage.static classA damage event system that handles entities with aFlockMembershipcomponent receiving damage.static classA ref change system that handles changes to theFlockMembershipcomponent on entities. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanJoinFlock(Ref<EntityStore> reference, Ref<EntityStore> flockReference, Store<EntityStore> store) A helper method for checking if a given entity is allowed to join the specified flock.static voidjoin(Ref<EntityStore> ref, Ref<EntityStore> flockRef, Store<EntityStore> store) A helper method to handle creating and attaching aFlockMembershipto an entity for a given flock, thus triggering the system logic to handle adding the entity to the flock.
-
Constructor Details
-
FlockMembershipSystems
public FlockMembershipSystems()
-
-
Method Details
-
canJoinFlock
public static boolean canJoinFlock(@Nonnull Ref<EntityStore> reference, @Nonnull Ref<EntityStore> flockReference, @Nonnull Store<EntityStore> store) A helper method for checking if a given entity is allowed to join the specified flock.The specific criteria checked include max flock size and whether the entity belongs to the list of allowed roles based on the current leader.
Note that calling
join(Ref, Ref, Store)will ignore these checks so they should be done beforehand if limiting flock members by these criteria is desired.- Parameters:
reference- reference to the entity wishing to join the flock.flockReference- reference to the flock being joined.store- the component store.- Returns:
trueif the entity can join the flock,falseotherwise.
-
join
public static void join(@Nonnull Ref<EntityStore> ref, @Nonnull Ref<EntityStore> flockRef, @Nonnull Store<EntityStore> store) A helper method to handle creating and attaching aFlockMembershipto an entity for a given flock, thus triggering the system logic to handle adding the entity to the flock.If the entity is already a member of a flock, a different code path will be triggered which will cause them to leave their old flock first.
- Parameters:
ref- The entity ref of the entity joining the flock.flockRef- The entity ref of the flock to join.store- TheStore<EntityStore>for component access.
-