Skip to content

Pig 5.46.0 ​

class · pocketmine\entity\animal\Pig · source

Extends Animal

Bedrock values: 10 health, movement 0.25, 0.9x0.9, bred with carrots, potatoes and beetroots, also tempted by a carrot on a stick. Can be saddled; a saddled pig is ridden by players (seat 0.63 up) and steered with a carrot on a stick held in the hand (it walks where the rider looks; using the stick boosts it 1.35x for 3 seconds and costs 2 durability, vanilla boostable component). An unsaddled pig can carry a baby zombie (seat 0.7 up). Ridden speed (approximate, Java): 0.164 blocks per tick. Loot: 1-3 porkchops (cooked when burning), +0-1 per Looting level, and the saddle. Struck by lightning it becomes a zombified piglin.

Constants ​

TAG_SADDLED ​

php
public const TAG_SADDLED = "Saddled"

Methods ​

canBeRiddenBy() ​

php
public function canBeRiddenBy(\pocketmine\entity\Entity $entity) : bool

canBeSteeredBy() ​

php
public function canBeSteeredBy(\pocketmine\player\Player $rider) : 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

getBoostItemTypeId() protected ​

php
protected function getBoostItemTypeId() : ?int

getBoostProperties() protected ​

php
protected function getBoostProperties() : array

getInitialSizeInfo() protected ​

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

getItemInteractButtonText() protected ​

php
protected function getItemInteractButtonText(\pocketmine\player\Player $player, \pocketmine\item\Item $item) : ?string

getName() ​

php
public function getName() : string

getNetworkTypeId() ​

php
public static function getNetworkTypeId() : string

getRiddenInput() protected ​

php
protected function getRiddenInput(\pocketmine\entity\riding\RiderInput $input) : array

getRiddenSpeed() protected ​

php
protected function getRiddenSpeed(\pocketmine\player\Player $rider) : float

getRideableSeats() ​

php
public function getRideableSeats() : array

initEntity() protected ​

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

isBreedingItem() ​

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

isSaddled() ​

php
public function isSaddled() : bool

onInteractWithItem() protected ​

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

onStruckByLightning() ​

php
public function onStruckByLightning(\pocketmine\entity\object\LightningBolt $bolt) : void

Vanilla: a pig struck by lightning turns into a zombified piglin holding a golden sword (not on Peaceful). The saddle is dropped.

registerGoals() protected ​

php
protected function registerGoals() : void

saveNBT() ​

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

setSaddled() ​

php
public function setSaddled(bool $saddled) : void

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.