Cat 5.46.0
Extends TameableAnimal
Bedrock values (entities/cat.json): 10 health (20 when tamed), 0.6x0.7 at scale 0.8 (babies 0.4), movement 0.3, 3 damage. Tamed with raw cod or salmon (1 in 3), then sits when ordered, follows its owner, is bred with fish (tamed, full health) and healed with fish (2 health). Wild cats hunt rabbits and baby turtles. 11 coats (VARIANT 0-10; all black ones only come from witch huts), dyeable collar (COLOR) once tamed, sound variant property. Loot (loot_tables/entities/cat.json): 0-2 string. Tamed cats sleep on their owner's bed while the owner sleeps (SLEEPING flag, PetSleepWithOwnerGoal) and may bring a morning gift from loot_tables/entities/cat_gift.json when the owner wakes up (DropGiftForOwnerGoal); they also sit on chests, lit furnaces and bed feet (SitOnBlockGoal), which keeps the chest closed. Creepers and phantoms avoid cats (see \pocketmine\entity\monster\Creeper and \pocketmine\entity\monster\Phantom).
Constants
GIFT_CHANCE
public const GIFT_CHANCE = 0.7drop_item_chance of behavior.drop_item_for
TAG_COLLAR_COLOR
public const TAG_COLLAR_COLOR = "CollarColor"TAG_GIFT_FOR_OWNER
public const TAG_GIFT_FOR_OWNER = "GiftForOwner"TAG_VARIANT
public const TAG_VARIANT = "Variant"VARIANT_BLACK
public const VARIANT_BLACK = 9VARIANT_BRITISH
public const VARIANT_BRITISH = 4VARIANT_CALICO
public const VARIANT_CALICO = 5VARIANT_JELLIE
public const VARIANT_JELLIE = 10VARIANT_PERSIAN
public const VARIANT_PERSIAN = 6VARIANT_RAGDOLL
public const VARIANT_RAGDOLL = 7VARIANT_RED
public const VARIANT_RED = 2VARIANT_SIAMESE
public const VARIANT_SIAMESE = 3VARIANT_TABBY
public const VARIANT_TABBY = 8VARIANT_TUXEDO
public const VARIANT_TUXEDO = 1VARIANT_WHITE
public const VARIANT_WHITE = 0Methods
canFallInLove() protected
protected function canFallInLove(\pocketmine\player\Player $player) : boolcreateBaby() protected
protected function createBaby(\pocketmine\entity\animal\Animal $partner, \pocketmine\entity\Location $location) : \pocketmine\entity\animal\AnimalgetAdultDrops() protected
protected function getAdultDrops() : arraygetAdultScale() protected
protected function getAdultScale() : floatgetBabyScale() protected
protected function getBabyScale() : floatgetCollarColor()
public function getCollarColor() : \pocketmine\block\utils\DyeColorgetInitialSizeInfo() protected
protected function getInitialSizeInfo() : \pocketmine\entity\EntitySizeInfogetName()
public function getName() : stringgetNetworkTypeId()
public static function getNetworkTypeId() : stringgetSeat()
public function getSeat() : ?\pocketmine\math\Vector3Block the cat sits on (chest, lit furnace or bed), if any.
getVariant()
public function getVariant() : inthasGiftForOwner()
public function hasGiftForOwner() : boolinitEntity() protected
protected function initEntity(\pocketmine\nbt\tag\CompoundTag $nbt) : voidisBreedingItem()
public function isBreedingItem(\pocketmine\item\Item $item) : boolisCatSittingOn()
public static function isCatSittingOn(\pocketmine\world\World $world, int $x, int $y, int $z, ?\pocketmine\entity\animal\Cat $except = null) : boolWhether a cat (other than $except) sits on the block at the position. Chests with a cat on top don't open.
isSeat()
public static function isSeat(\pocketmine\world\World $world, int $x, int $y, int $z) : boolWhether cats like to sit on the block at the position: a chest nobody is using, a lit furnace or the foot of a bed, with nothing on top.
isSleepingWithOwner()
public function isSleepingWithOwner() : boolofferGift()
public function offerGift(\pocketmine\player\Player $owner) : ?\pocketmine\entity\object\ItemEntityDrop attempt of the morning gift: 70% of the time an item of the cat_gift loot table lands next to the owner. The cat has no gift left afterwards either way.
onInteractWithItem() protected
protected function onInteractWithItem(\pocketmine\player\Player $player, \pocketmine\item\Item $item) : boolonTamedChanged() protected
protected function onTamedChanged() : voidregisterGoals() protected
protected function registerGoals() : voidrollGift()
public static function rollGift() : \pocketmine\item\ItemOne roll of loot_tables/entities/cat_gift.json.
saveNBT()
public function saveNBT() : \pocketmine\nbt\tag\CompoundTagsetCollarColor()
public function setCollarColor(\pocketmine\block\utils\DyeColor $color) : voidsetGiftForOwner()
public function setGiftForOwner(bool $gift) : voidsetSittingOnBlock()
public function setSittingOnBlock(?\pocketmine\math\Vector3 $block) : voidHops on the given block and sits there, or gets up (null).
setVariant()
public function setVariant(int $variant) : voidsleepWithOwnerOn()
public function sleepWithOwnerOn(\pocketmine\math\Vector3 $bed) : voidHops on the given bed block and falls asleep there (the owner is sleeping in the bed).
stopSleepingWithOwner()
public function stopSleepingWithOwner(bool $ownerWokeUp) : voidWakes the cat up. If the owner woke up too, the cat now has a morning gift for them (on_wake_with_owner).
syncNetworkData() protected
protected function syncNetworkData(\pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection $properties) : void