TameableAnimal 5.46.0
Extends Animal
An animal that a player can tame (wolves, cats, parrots, horses...). A tamed animal has an owner, can be ordered to sit, and its owner is shown to clients (OWNER_EID, TAMED and SITTING flags).
The owner is saved by UUID ("OwnerUUID", PocketMine-specific: vanilla saves the owner's actor unique ID, which PocketMine doesn't keep across sessions).
Constants
TAG_OWNER_UUID
public const TAG_OWNER_UUID = "OwnerUUID"TAG_SITTING
public const TAG_SITTING = "Sitting"TAG_TAMED
public const TAG_TAMED = "IsTamed"Properties
$ownerUuid protected
protected ?\Ramsey\Uuid\UuidInterface $ownerUuid$sitting protected
protected bool $sittingMethods
canFallInLove() protected
protected function canFallInLove(\pocketmine\player\Player $player) : boolcanMate()
public function canMate(\pocketmine\entity\animal\Animal $other) : boolgetOwner()
public function getOwner() : ?\pocketmine\player\PlayerReturns the owner if it is online and in the same world.
getOwnerUuid()
public function getOwnerUuid() : ?\Ramsey\Uuid\UuidInterfaceinitEntity() protected
protected function initEntity(\pocketmine\nbt\tag\CompoundTag $nbt) : voidisOwner()
public function isOwner(\pocketmine\entity\Living $entity) : boolisSitting()
public function isSitting() : boolisTamed()
public function isTamed() : boolonDispose() protected
protected function onDispose() : voidonTamedChanged() protected
protected function onTamedChanged() : voidCalled when the animal is tamed or untamed (health and goals of tamed wolves and cats change).
requiresTameToBreed() protected
protected function requiresTameToBreed() : boolWhether only tamed animals of this kind breed (wolves, cats, llamas, horses).
saveNBT()
public function saveNBT() : \pocketmine\nbt\tag\CompoundTagsetAttackTarget()
public function setAttackTarget(?\pocketmine\entity\Living $target) : voidsetOwner()
public function setOwner(?\pocketmine\player\Player $owner) : voidTames the animal for the player (no chance roll, no particles).
setSitting()
public function setSitting(bool $sitting) : voidsyncNetworkData() protected
protected function syncNetworkData(\pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection $properties) : voidtryTame()
public function tryTame(\pocketmine\player\Player $player, float $chance) : boolFeeding attempt with a taming item: succeeds with the given chance (vanilla 1/3). Shows hearts or smoke. Returns whether the animal was tamed.
