Skip to content

Cat 5.46.0 ​

class · pocketmine\entity\animal\Cat · source

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 ​

php
public const GIFT_CHANCE = 0.7

drop_item_chance of behavior.drop_item_for

TAG_COLLAR_COLOR ​

php
public const TAG_COLLAR_COLOR = "CollarColor"

TAG_GIFT_FOR_OWNER ​

php
public const TAG_GIFT_FOR_OWNER = "GiftForOwner"

TAG_VARIANT ​

php
public const TAG_VARIANT = "Variant"

VARIANT_BLACK ​

php
public const VARIANT_BLACK = 9

VARIANT_BRITISH ​

php
public const VARIANT_BRITISH = 4

VARIANT_CALICO ​

php
public const VARIANT_CALICO = 5

VARIANT_JELLIE ​

php
public const VARIANT_JELLIE = 10

VARIANT_PERSIAN ​

php
public const VARIANT_PERSIAN = 6

VARIANT_RAGDOLL ​

php
public const VARIANT_RAGDOLL = 7

VARIANT_RED ​

php
public const VARIANT_RED = 2

VARIANT_SIAMESE ​

php
public const VARIANT_SIAMESE = 3

VARIANT_TABBY ​

php
public const VARIANT_TABBY = 8

VARIANT_TUXEDO ​

php
public const VARIANT_TUXEDO = 1

VARIANT_WHITE ​

php
public const VARIANT_WHITE = 0

Methods ​

canFallInLove() protected ​

php
protected function canFallInLove(\pocketmine\player\Player $player) : bool

createBaby() protected ​

php
protected function createBaby(\pocketmine\entity\animal\Animal $partner, \pocketmine\entity\Location $location) : \pocketmine\entity\animal\Animal

getAdultDrops() protected ​

php
protected function getAdultDrops() : array

getAdultScale() protected ​

php
protected function getAdultScale() : float

getBabyScale() protected ​

php
protected function getBabyScale() : float

getCollarColor() ​

php
public function getCollarColor() : \pocketmine\block\utils\DyeColor

getInitialSizeInfo() protected ​

php
protected function getInitialSizeInfo() : \pocketmine\entity\EntitySizeInfo

getName() ​

php
public function getName() : string

getNetworkTypeId() ​

php
public static function getNetworkTypeId() : string

getSeat() ​

php
public function getSeat() : ?\pocketmine\math\Vector3

Block the cat sits on (chest, lit furnace or bed), if any.

getVariant() ​

php
public function getVariant() : int

hasGiftForOwner() ​

php
public function hasGiftForOwner() : bool

initEntity() protected ​

php
protected function initEntity(\pocketmine\nbt\tag\CompoundTag $nbt) : void

isBreedingItem() ​

php
public function isBreedingItem(\pocketmine\item\Item $item) : bool

isCatSittingOn() ​

php
public static function isCatSittingOn(\pocketmine\world\World $world, int $x, int $y, int $z, ?\pocketmine\entity\animal\Cat $except = null) : bool

Whether a cat (other than $except) sits on the block at the position. Chests with a cat on top don't open.

isSeat() ​

php
public static function isSeat(\pocketmine\world\World $world, int $x, int $y, int $z) : bool

Whether 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() ​

php
public function isSleepingWithOwner() : bool

offerGift() ​

php
public function offerGift(\pocketmine\player\Player $owner) : ?\pocketmine\entity\object\ItemEntity

Drop 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 ​

php
protected function onInteractWithItem(\pocketmine\player\Player $player, \pocketmine\item\Item $item) : bool

onTamedChanged() protected ​

php
protected function onTamedChanged() : void

registerGoals() protected ​

php
protected function registerGoals() : void

rollGift() ​

php
public static function rollGift() : \pocketmine\item\Item

One roll of loot_tables/entities/cat_gift.json.

saveNBT() ​

php
public function saveNBT() : \pocketmine\nbt\tag\CompoundTag

setCollarColor() ​

php
public function setCollarColor(\pocketmine\block\utils\DyeColor $color) : void

setGiftForOwner() ​

php
public function setGiftForOwner(bool $gift) : void

setSittingOnBlock() ​

php
public function setSittingOnBlock(?\pocketmine\math\Vector3 $block) : void

Hops on the given block and sits there, or gets up (null).

setVariant() ​

php
public function setVariant(int $variant) : void

sleepWithOwnerOn() ​

php
public function sleepWithOwnerOn(\pocketmine\math\Vector3 $bed) : void

Hops on the given bed block and falls asleep there (the owner is sleeping in the bed).

stopSleepingWithOwner() ​

php
public function stopSleepingWithOwner(bool $ownerWokeUp) : void

Wakes the cat up. If the owner woke up too, the cat now has a morning gift for them (on_wake_with_owner).

syncNetworkData() protected ​

php
protected function syncNetworkData(\pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection $properties) : void

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.