Package com.minecolonies.api.colony
Interface IAnimalData
- All Superinterfaces:
net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
- All Known Implementing Classes:
AnimalData
public interface IAnimalData
extends net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Data interface for animals managed by the Animal Manager.
-
Method Summary
Modifier and TypeMethodDescriptionvoidClear the dirty flag for this animal data.floatReturns the current combat cooldown of the animal.Gets the home building of the animal.intgetId()Get the animal data ID.@NotNull net.minecraft.core.BlockPosGets the last position of the animal.Optional<IManagedAnimal<? extends net.minecraft.world.entity.animal.Animal>>Get the animal entity.getOwner()Gets the owner of the animal.getUUID()Get the globally unique identifier associated with this animal data.voidInitializes the entities values from animal data.booleanisDirty()Check if this animal data is dirty and needs syncing.voidMark this animal data as dirty and in need of syncing / saving.voidonRemoveBuilding(IBuilding building) Called when a building is removed.voidserializeViewNetworkData(@NotNull net.minecraft.network.FriendlyByteBuf buf) Writes the animal data to a byte buf for transition.voidsetCombatCooldown(float newCooldown) Sets the combat cooldown of the animal.voidsetHomeBuilding(@NotNull IBuilding building) Sets the home building of the animal.voidsetLastPosition(net.minecraft.core.BlockPos lastPosition) Sets the last position of the animal.voidsetManagedAnimal(IManagedAnimal<? extends net.minecraft.world.entity.animal.Animal> entity) Set the animal entity.voidSets the owner of the animal.voidupdate(int tickRate) Update the animal data.Methods inherited from interface net.minecraftforge.common.util.INBTSerializable
deserializeNBT, serializeNBT
-
Method Details
-
getId
int getId()Get the animal data ID.- Returns:
- the animal data ID
-
getUUID
UUID getUUID()Get the globally unique identifier associated with this animal data.- Returns:
- the globally unique identifier associated with this animal data.
-
initEntityValues
void initEntityValues()Initializes the entities values from animal data. -
getManagedAnimal
Optional<IManagedAnimal<? extends net.minecraft.world.entity.animal.Animal>> getManagedAnimal()Get the animal entity.- Returns:
- the animal entity.
-
setManagedAnimal
Set the animal entity.- Parameters:
entity- the animal entity.
-
clearDirty
void clearDirty()Clear the dirty flag for this animal data. -
isDirty
boolean isDirty()Check if this animal data is dirty and needs syncing.- Returns:
- true if dirty, false otherwise
-
markDirty
void markDirty()Mark this animal data as dirty and in need of syncing / saving. -
update
void update(int tickRate) Update the animal data.- Parameters:
tickRate- the tick rate
-
serializeViewNetworkData
void serializeViewNetworkData(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf) Writes the animal data to a byte buf for transition.- Parameters:
buf- Buffer to write to.
-
getHomeBuilding
IBuilding getHomeBuilding()Gets the home building of the animal.- Returns:
- the home building, or null if the animal does not have a home building.
-
setHomeBuilding
Sets the home building of the animal.- Parameters:
building- the new home building of the animal.
-
onRemoveBuilding
Called when a building is removed.- Parameters:
building- the building that was removed.
-
setLastPosition
void setLastPosition(net.minecraft.core.BlockPos lastPosition) Sets the last position of the animal.- Parameters:
lastPosition- the last position of the animal.
-
getLastPosition
@NotNull @NotNull net.minecraft.core.BlockPos getLastPosition()Gets the last position of the animal.- Returns:
- the last position of the animal.
-
getCombatCooldown
float getCombatCooldown()Returns the current combat cooldown of the animal. A higher value means the animal is currently less ready for combat.- Returns:
- the current combat cooldown of the animal
-
setCombatCooldown
void setCombatCooldown(float newCooldown) Sets the combat cooldown of the animal. Zero is completely ready, higher values represent equipment or morale damage that can result in unreadiness.- Parameters:
newCooldown- the new combat cooldown of the animal
-
getOwner
UUID getOwner()Gets the owner of the animal.- Returns:
- the owner of the animal
-
setOwner
Sets the owner of the animal.- Parameters:
owner- the new owner of the animal
-