Interface IAnimalManager

All Known Implementing Classes:
AnimalManager

public interface IAnimalManager
The interface for managed animals, such as Cavalry horses. Note that this does not include farm animals.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clear the dirty flag.
    createAndRegisterAnimalData(IManagedAnimal<? extends net.minecraft.world.entity.animal.Animal> entity)
    The colony this manager belongs to.
    getAnimal(int id)
    Get the animal data by ID.
    Get all managed animals.
    getAnimalsOfClassByHome(Class<? extends net.minecraft.world.entity.animal.Animal> animalClass, @Nullable IBuilding home)
    Get all managed animals of a certain class, with the specified home (or if home is null, all animals of that class).
    int
    Get the current number of managed animals.
    void
    Mark this manager dirty, and in need of syncing / saving.
    void
    Actions to execute on a colony tick.
    void
    read(@NotNull net.minecraft.nbt.CompoundTag compound)
    Read the animal information from nbt.
    void
    registerAnimal(IManagedAnimal<? extends net.minecraft.world.entity.animal.Animal> entity)
    Register a civilian entity with the colony
    void
    sendPackets(@NotNull Set<net.minecraft.server.level.ServerPlayer> closeSubscribers, @NotNull Set<net.minecraft.server.level.ServerPlayer> newSubscribers)
    Send the necessary packets to subscribers.
    boolean
    tickAnimalData(int tickRate)
    Actions to execute on a tick.
    void
    write(@NotNull net.minecraft.nbt.CompoundTag compoundNBT)
    Write the animal information to nbt.
  • Method Details

    • getCurrentAnimalCount

      int getCurrentAnimalCount()
      Get the current number of managed animals.
    • registerAnimal

      void registerAnimal(IManagedAnimal<? extends net.minecraft.world.entity.animal.Animal> entity)
      Register a civilian entity with the colony
      Parameters:
      entity - civilian to register
    • getAnimal

      IAnimalData getAnimal(int id)
      Get the animal data by ID.
      Parameters:
      id - The animal ID.
      Returns:
      The animal data, or null if not found.
    • getAnimals

      List<IAnimalData> getAnimals()
      Get all managed animals.
    • getAnimalsOfClassByHome

      List<IAnimalData> getAnimalsOfClassByHome(Class<? extends net.minecraft.world.entity.animal.Animal> animalClass, @Nullable @Nullable IBuilding home)
      Get all managed animals of a certain class, with the specified home (or if home is null, all animals of that class).
    • createAndRegisterAnimalData

      IAnimalData createAndRegisterAnimalData(IManagedAnimal<? extends net.minecraft.world.entity.animal.Animal> entity)
      The colony this manager belongs to.
      Returns:
      The colony.
    • read

      void read(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound)
      Read the animal information from nbt.
      Parameters:
      compound - the compound to read it from.
    • write

      void write(@NotNull @NotNull net.minecraft.nbt.CompoundTag compoundNBT)
      Write the animal information to nbt.
      Parameters:
      compoundNBT - the compound to write it to.
    • onColonyTick

      void onColonyTick(IColony colony)
      Actions to execute on a colony tick.
      Parameters:
      colony - the event.
    • tickAnimalData

      boolean tickAnimalData(int tickRate)
      Actions to execute on a tick.
      Parameters:
      tickRate - the event.
    • markDirty

      void markDirty()
      Mark this manager dirty, and in need of syncing / saving.
    • clearDirty

      void clearDirty()
      Clear the dirty flag.
    • sendPackets

      void sendPackets(@NotNull @NotNull Set<net.minecraft.server.level.ServerPlayer> closeSubscribers, @NotNull @NotNull Set<net.minecraft.server.level.ServerPlayer> newSubscribers)
      Send the necessary packets to subscribers.
      Parameters:
      closeSubscribers - players that were subscribed but are now out of range
      newSubscribers - players that have just come into range and need data