Skip to content

Boat 5.46.0 ​

class · pocketmine\entity\vehicle\Boat · source

Extends Entity

A boat (vanilla minecraft:boat, every wood and the bamboo raft): two seats, the first one steers. A player driving a boat moves it with its own client (Bedrock boats are client-predicted vehicles): the server checks the positions it gets and animates the paddles for the other players. Boats nobody steers float, drift and slide with vanilla's physics (Java AbstractBoat.floatBoat()): they keep 90% of their speed per tick in water, the friction of the blocks under them on land (much more on ice), and come back up to the surface.

Like minecarts, hits add 10 x the damage to an accumulated "damage" value that decays by 1 per tick: the boat breaks above 40, at once (without drops) when hit by a creative player. Falls don't break Bedrock boats, lava does.

Constants ​

BREAK_DAMAGE ​

php
public const BREAK_DAMAGE = 40.0

Accumulated damage above which the boat breaks.

BUOYANCY_DATA ​

php
public const BUOYANCY_DATA = '{"apply_gravity":true,"base_buoyancy":1.0,"big_wave_probability":0.02999999932944775,"big_wave_speed":10.0,"drag_down_on_buoyancy_removed":0.0,"liquid_blocks":["minecraft:water","minecraft:flowing_water"],"simulate_waves":false}'

Buoyancy settings of the client's own simulation (vanilla minecraft:buoyant, the BDS values GeyserMC sends): without them the driver's client neither floats the boat nor moves it on land. No waves: the server doesn't bob boats.

MAX_CLIENT_MOVE ​

php
public const MAX_CLIENT_MOVE = 6.0

Furthest a driver's client may move the boat in one input, in blocks (boats on blue ice reach ~3.6).

MAX_PASSENGER_WIDTH ​

php
public const MAX_PASSENGER_WIDTH = 1.375

Widest passenger a boat can carry (vanilla passenger_max_width).

NETWORK_Y_OFFSET ​

php
public const NETWORK_Y_OFFSET = 0.375

Network position of a boat: Bedrock clients place boats by a point 0.375 above their bottom.

OUT_OF_CONTROL_TICKS ​

php
public const OUT_OF_CONTROL_TICKS = 60

Ticks under water after which the passengers are thrown out.

PADDLE_SPEED ​

php
public const PADDLE_SPEED = \M_PI / 8

Phase advanced by a moving paddle per tick, in radians (vanilla PADDLE_SPEED).

TAG_VARIANT ​

php
public const TAG_VARIANT = "Variant"

Properties ​

$damage protected ​

php
protected float $damage

$hurtDirection protected ​

php
protected int $hurtDirection

$hurtTime protected ​

php
protected int $hurtTime

$variant protected ​

php
protected \pocketmine\entity\vehicle\BoatVariant $variant

Methods ​

animateHurt() protected ​

php
protected function animateHurt() : void

attack() ​

php
public function attack(\pocketmine\event\entity\EntityDamageEvent $source) : void

breakBoat() ​

php
public function breakBoat(bool $drops) : void

Breaks the boat: drops its item (if $drops) and removes it. A chest boat drops its contents in any case.

broadcastMovement() protected ​

php
protected function broadcastMovement(bool $teleport = false) : void

canAddPassenger() ​

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

canBeDamagedBy() protected ​

php
protected function canBeDamagedBy(\pocketmine\event\entity\EntityDamageEvent $source) : bool

Whether this kind of damage hurts boats: hits, projectiles, explosions and lava (Bedrock hurt_on_condition), not fire, falls, drowning...

canBeRiddenBy() ​

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

canBeStoodOn() ​

php
public function canBeStoodOn() : bool

canPickUp() protected ​

php
protected function canPickUp(\pocketmine\entity\Entity $entity) : bool

Whether the entity gets in this boat when they bump into each other.

entityBaseTick() protected ​

php
protected function entityBaseTick(int $tickDiff = 1) : bool

getBoatDrops() ​

php
public function getBoatDrops() : array

Returns the items dropped by the boat when it breaks (container contents are dropped separately).

getBoatItem() ​

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

Returns the item this boat drops when broken (and that picks it).

getControllingPassenger() ​

php
public function getControllingPassenger() : ?\pocketmine\entity\Entity

getDamage() ​

php
public function getDamage() : float

Returns the accumulated damage (the boat breaks above Boat::BREAK_DAMAGE).

getForwardDirection() ​

php
public function getForwardDirection() : \pocketmine\math\Vector3

Direction the boat moves when paddling forwards (its Bedrock yaw minus 90 degrees).

getHeadYaw() ​

php
public function getHeadYaw() : float

getHurtDirection() ​

php
public function getHurtDirection() : int

getHurtTime() ​

php
public function getHurtTime() : int

getInitialDragMultiplier() protected ​

php
protected function getInitialDragMultiplier() : float

getInitialGravity() protected ​

php
protected function getInitialGravity() : float

getInitialSizeInfo() protected ​

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

getInteractButtonText() ​

php
public function getInteractButtonText(\pocketmine\player\Player $player) : string

getName() ​

php
public function getName() : string

getNetworkTypeId() ​

php
public static function getNetworkTypeId() : string

getOffsetPosition() ​

php
public function getOffsetPosition(\pocketmine\math\Vector3 $vector3) : \pocketmine\math\Vector3

getPaddleTime() ​

php
public function getPaddleTime(bool $left) : float

Returns the animation phase of a paddle in radians (0 when it doesn't move).

getPassengerPosition() ​

php
public function getPassengerPosition(\pocketmine\entity\Entity $passenger) : \pocketmine\math\Vector3

getPickedItem() ​

php
public function getPickedItem() : ?\pocketmine\item\Item

getRideableSeats() ​

php
public function getRideableSeats() : array

getRiderRotation() protected ​

php
protected function getRiderRotation(int $seat) : float

Vanilla rotate_rider_by of a seat shared by two riders: people and monsters face forwards (-90), animals sit across the boat.

getVariant() ​

php
public function getVariant() : \pocketmine\entity\vehicle\BoatVariant

handleClientVehicleMovement() ​

php
public function handleClientVehicleMovement(\pocketmine\player\Player $rider, \pocketmine\math\Vector3 $pos, float $yaw, float $pitch) : bool

Called when the client of the driver moved this boat (client-predicted vehicle). Accepts the movement if the player steers the boat, the distance is plausible and the boat doesn't end up inside blocks.

handleRiderInput() ​

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

Called every tick with the input of the player steering this boat.

hasMovementUpdate() ​

php
public function hasMovementUpdate() : bool

initEntity() protected ​

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

isBroken() ​

php
public function isBroken() : bool

isMovedByClient() ​

php
public function isMovedByClient() : bool

Returns whether the client of the driver moves this boat itself: the server then doesn't move it and doesn't send its movement back to that client.

move() protected ​

php
protected function move(float $dx, float $dy, float $dz) : void

onDeathUpdate() protected ​

php
protected function onDeathUpdate(int $tickDiff) : bool

onInteract() ​

php
public function onInteract(\pocketmine\player\Player $player, \pocketmine\math\Vector3 $clickPos) : bool

onPassengerAdded() protected ​

php
protected function onPassengerAdded(\pocketmine\entity\Entity $passenger) : void

onPassengerRemoved() protected ​

php
protected function onPassengerRemoved(\pocketmine\entity\Entity $passenger) : void

pushAndPickupEntities() protected ​

php
protected function pushAndPickupEntities() : void

Vanilla AbstractBoat.tick() end: mobs bumping into a boat nobody steers get in (Bedrock pull_in_entities), boats and mobs push each other, players push a boat they walk into.

resyncClientVehicle() ​

php
public function resyncClientVehicle(\pocketmine\player\Player $rider) : void

Sends the boat's position to the client of its driver, which moved it somewhere it was not allowed to go.

saveNBT() ​

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

setDamage() ​

php
public function setDamage(float $damage) : void

setVariant() ​

php
public function setVariant(\pocketmine\entity\vehicle\BoatVariant $variant) : void

syncNetworkData() protected ​

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

tryChangeMovement() protected ​

php
protected function tryChangeMovement() : void

updateFallState() protected ​

php
protected function updateFallState(float $distanceThisTick, bool $onGround) : ?float

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