Skip to content

NautilusTrait 5.46.0 ​

trait · pocketmine\entity\aquatic\NautilusTrait · source

Taming equipment and riding shared by the nautilus and the zombie nautilus (nautilus.json, zombie_nautilus.json):

  • Inventory: a HorseInventory ("horse" container) with the saddle in slot 0 and nautilus armor in slot 1, opened by sneaking and using a tamed adult or with the inventory button of its rider (vanilla). Saddles and armor are also put on by using them on a tamed adult; shears take the armor off first, then the saddle (one use each, only while nobody rides it). Nautilus armor protects like horse armor (copper 4, iron 5, gold 7, diamond 11, netherite 19) and is shown to viewers in the body slot of MobArmorEquipmentPacket. Saved as "ChestItems".
  • Riding: one player seat 0.925 up (third person camera 7 blocks away). Once saddled, the rider steers it: in water with free camera controls (WASD_FREE_CAMERA_CONTROLLED: forwards follows the camera pitch, strafing at 0.7x, backwards at 0.5x, up to 6.5 blocks per second), out of water like a ground mount (WASD_CONTROLLED, 0.88 blocks per second). Holding then releasing jump dashes (CAN_DASH, HAS_DASH_COOLDOWN, 2 s cooldown) in the rider's look direction: vanilla dash_action momentum 154 in water and 42 on land times the player-controlled movement (0.015), 0.1 up. A rider in water breathes (vanilla underwater_mount_breathing; Breath of the Nautilus is not sent).

The using class implements \pocketmine\entity\riding\MountInventoryHolder, provides isTamed(), NautilusTrait::isInWaterForRiding() and NautilusTrait::swimTowards(), and calls NautilusTrait::initNautilusInventory(), NautilusTrait::saveNautilusInventory(), NautilusTrait::tickNautilus() (entityBaseTick), NautilusTrait::handleDashInput() (handleRiderInput), NautilusTrait::interactWithEquipment() and NautilusTrait::syncNautilusData().

Constants ​

DASH_COOLDOWN_TICKS ​

php
public const DASH_COOLDOWN_TICKS = 40

RIDDEN_GROUND_SPEED ​

php
public const RIDDEN_GROUND_SPEED = 0.044

0.88 blocks per second (minecraft.wiki).

RIDDEN_SWIM_SPEED ​

php
public const RIDDEN_SWIM_SPEED = 0.325

6.5 blocks per second (minecraft.wiki).

TAG_CHEST_ITEMS ​

php
public const TAG_CHEST_ITEMS = "ChestItems"

Properties ​

$inventory protected ​

php
protected \pocketmine\inventory\HorseInventory $inventory

Methods ​

canBeSteeredBy() ​

php
public function canBeSteeredBy(\pocketmine\player\Player $rider) : bool

canHoldInSlot() ​

php
public function canHoldInSlot(int $slot, \pocketmine\item\Item $item) : bool

canOpenInventory() ​

php
public function canOpenInventory(\pocketmine\player\Player $player) : bool

canWearSaddle() ​

php
public function canWearSaddle() : bool

closeNautilusInventory() protected ​

php
protected function closeNautilusInventory() : void

dash() ​

php
public function dash(float $power, float $yaw, float $pitch) : void

Dashes with the given power (0.4 to 1) in the given direction (the rider's look; horizontal on land) and starts the cooldown. A client predicting the nautilus moves it itself; the server only does it when it moves it.

getArmorPoints() ​

php
public function getArmorPoints() : int

getArmorSlotIcon() ​

php
public function getArmorSlotIcon() : string

getArmorSlotItemNames() ​

php
public function getArmorSlotItemNames() : array

getEquipmentButtonText() protected ​

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

The interaction button for the held item on a tamed adult, or null.

getEquipmentDrops() protected ​

php
protected function getEquipmentDrops() : array

Returns the equipment dropped on death (saddle and armor).

getInventory() ​

php
public function getInventory() : \pocketmine\inventory\HorseInventory

getNautilusArmor() ​

php
public function getNautilusArmor() : \pocketmine\item\Item

Returns the nautilus armor worn (air if none).

getPlayerSeat() protected ​

php
protected function getPlayerSeat() : \pocketmine\entity\riding\RideableSeat

givesUnderwaterBreathingTo() ​

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

handleDashInput() protected ​

php
protected function handleDashInput(\pocketmine\player\Player $rider, \pocketmine\entity\riding\RiderInput $input) : void

Holding jump charges a dash, releasing it dashes (same power as a camel's dash).

hasArmorSlot() ​

php
public function hasArmorSlot() : bool

hasDashCooldown() ​

php
public function hasDashCooldown() : bool

initNautilusInventory() protected ​

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

interactWithEquipment() protected ​

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

The equipment interactions of a tamed adult (vanilla nautilus_tame_adult interact): saddle, armor, shears, and sneaking opens the inventory. Returns whether the item was used.

isDrivenByRiderClient() protected ​

php
protected function isDrivenByRiderClient() : bool

isInWaterForRiding() ​

php
abstract public function isInWaterForRiding() : bool

Whether the mob swims for riding purposes (vanilla in_water filter of the saddled states).

isNautilusArmor() ​

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

isSaddled() ​

php
public function isSaddled() : bool

isTamed() ​

php
abstract public function isTamed() : bool

openInventory() ​

php
public function openInventory(\pocketmine\player\Player $player) : bool

saveNautilusInventory() protected ​

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

sendSpawnPacket() protected ​

php
protected function sendSpawnPacket(\pocketmine\player\Player $player) : void

setNautilusArmor() ​

php
public function setNautilusArmor(\pocketmine\item\Item $armor) : void

setSaddled() ​

php
public function setSaddled(bool $saddled) : void

steer() protected ​

php
protected function steer(\pocketmine\player\Player $rider, \pocketmine\entity\riding\RiderInput $input) : void

In water the nautilus goes where the rider looks (free camera controls); on land it is driven like a ground mount, slowly.

stopSwimming() protected ​

php
abstract protected function stopSwimming() : void

Stops swimming towards a position (ridden in water without input).

swimTowards() protected ​

php
abstract protected function swimTowards(float $x, float $y, float $z, float $speed) : void

Swims towards the position at the given speed in blocks per tick (ridden in water).

syncNautilusData() protected ​

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

tickNautilus() protected ​

php
protected function tickNautilus(int $tickDiff) : void

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