Interface SchoolableFish

All Superinterfaces:
Attributable, Audience, Bucketable, CommandSender, Creature, Damageable, Entity, Fish, Frictional, HoverEventSource<HoverEvent.ShowEntity>, Leashable, LivingEntity, Lootable, Metadatable, Mob, Nameable, Permissible, PersistentDataHolder, PersistentDataViewHolder, Pointered, ProjectileSource, ServerOperator, Sound.Emitter, WaterMob
All Known Subinterfaces:
Cod, Salmon, TropicalFish

@NullMarked public interface SchoolableFish extends Fish
Represents a fish that can school with other fish.
  • Method Details

    • startFollowing

      void startFollowing(SchoolableFish leader)
      Forces this fish to follow the given fish.
      Parameters:
      leader - fish to follow
    • stopFollowing

      void stopFollowing()
      Causes the fish to stop following their current leader.
    • getSchoolSize

      int getSchoolSize()
      Gets the amount of fish currently following this fish.
      Returns:
      school size
    • getMaxSchoolSize

      int getMaxSchoolSize()
      Gets the maximum number of fish that will naturally follow this fish.
      Returns:
      max school size
    • getSchoolLeader

      @Nullable SchoolableFish getSchoolLeader()
      Gets the fish that this entity is currently following.
      Returns:
      following fish