NautilusTrait 5.46.0
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
public const DASH_COOLDOWN_TICKS = 40RIDDEN_GROUND_SPEED
public const RIDDEN_GROUND_SPEED = 0.0440.88 blocks per second (minecraft.wiki).
RIDDEN_SWIM_SPEED
public const RIDDEN_SWIM_SPEED = 0.3256.5 blocks per second (minecraft.wiki).
TAG_CHEST_ITEMS
public const TAG_CHEST_ITEMS = "ChestItems"Properties
$inventory protected
protected \pocketmine\inventory\HorseInventory $inventoryMethods
canBeSteeredBy()
public function canBeSteeredBy(\pocketmine\player\Player $rider) : boolcanHoldInSlot()
public function canHoldInSlot(int $slot, \pocketmine\item\Item $item) : boolcanOpenInventory()
public function canOpenInventory(\pocketmine\player\Player $player) : boolcanWearSaddle()
public function canWearSaddle() : boolcloseNautilusInventory() protected
protected function closeNautilusInventory() : voiddash()
public function dash(float $power, float $yaw, float $pitch) : voidDashes 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()
public function getArmorPoints() : intgetArmorSlotIcon()
public function getArmorSlotIcon() : stringgetArmorSlotItemNames()
public function getArmorSlotItemNames() : arraygetEquipmentButtonText() protected
protected function getEquipmentButtonText(\pocketmine\player\Player $player, \pocketmine\item\Item $item) : ?stringThe interaction button for the held item on a tamed adult, or null.
getEquipmentDrops() protected
protected function getEquipmentDrops() : arrayReturns the equipment dropped on death (saddle and armor).
getInventory()
public function getInventory() : \pocketmine\inventory\HorseInventorygetNautilusArmor()
public function getNautilusArmor() : \pocketmine\item\ItemReturns the nautilus armor worn (air if none).
getPlayerSeat() protected
protected function getPlayerSeat() : \pocketmine\entity\riding\RideableSeatgivesUnderwaterBreathingTo()
public function givesUnderwaterBreathingTo(\pocketmine\entity\Entity $passenger) : boolhandleDashInput() protected
protected function handleDashInput(\pocketmine\player\Player $rider, \pocketmine\entity\riding\RiderInput $input) : voidHolding jump charges a dash, releasing it dashes (same power as a camel's dash).
hasArmorSlot()
public function hasArmorSlot() : boolhasDashCooldown()
public function hasDashCooldown() : boolinitNautilusInventory() protected
protected function initNautilusInventory(\pocketmine\nbt\tag\CompoundTag $nbt) : voidinteractWithEquipment() protected
protected function interactWithEquipment(\pocketmine\player\Player $player, \pocketmine\item\Item $item) : boolThe 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
protected function isDrivenByRiderClient() : boolisInWaterForRiding()
abstract public function isInWaterForRiding() : boolWhether the mob swims for riding purposes (vanilla in_water filter of the saddled states).
isNautilusArmor()
public static function isNautilusArmor(\pocketmine\item\Item $item) : boolisSaddled()
public function isSaddled() : boolisTamed()
abstract public function isTamed() : boolopenInventory()
public function openInventory(\pocketmine\player\Player $player) : boolsaveNautilusInventory() protected
protected function saveNautilusInventory(\pocketmine\nbt\tag\CompoundTag $nbt) : voidsendSpawnPacket() protected
protected function sendSpawnPacket(\pocketmine\player\Player $player) : voidsetNautilusArmor()
public function setNautilusArmor(\pocketmine\item\Item $armor) : voidsetSaddled()
public function setSaddled(bool $saddled) : voidsteer() protected
protected function steer(\pocketmine\player\Player $rider, \pocketmine\entity\riding\RiderInput $input) : voidIn water the nautilus goes where the rider looks (free camera controls); on land it is driven like a ground mount, slowly.
stopSwimming() protected
abstract protected function stopSwimming() : voidStops swimming towards a position (ridden in water without input).
swimTowards() protected
abstract protected function swimTowards(float $x, float $y, float $z, float $speed) : voidSwims towards the position at the given speed in blocks per tick (ridden in water).
syncNautilusData() protected
protected function syncNautilusData(\pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection $properties) : voidtickNautilus() protected
protected function tickNautilus(int $tickDiff) : void