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 TypeMethodDescriptionvoidClear 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).intGet the current number of managed animals.voidMark this manager dirty, and in need of syncing / saving.voidonColonyTick(IColony colony) Actions to execute on a colony tick.voidread(@NotNull net.minecraft.nbt.CompoundTag compound) Read the animal information from nbt.voidregisterAnimal(IManagedAnimal<? extends net.minecraft.world.entity.animal.Animal> entity) Register a civilian entity with the colonyvoidsendPackets(@NotNull Set<net.minecraft.server.level.ServerPlayer> closeSubscribers, @NotNull Set<net.minecraft.server.level.ServerPlayer> newSubscribers) Send the necessary packets to subscribers.booleantickAnimalData(int tickRate) Actions to execute on a tick.voidwrite(@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
Register a civilian entity with the colony- Parameters:
entity- civilian to register
-
getAnimal
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
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 rangenewSubscribers- players that have just come into range and need data
-