Boat 5.46.0
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
public const BREAK_DAMAGE = 40.0Accumulated damage above which the boat breaks.
BUOYANCY_DATA
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
public const MAX_CLIENT_MOVE = 6.0Furthest a driver's client may move the boat in one input, in blocks (boats on blue ice reach ~3.6).
MAX_PASSENGER_WIDTH
public const MAX_PASSENGER_WIDTH = 1.375Widest passenger a boat can carry (vanilla passenger_max_width).
NETWORK_Y_OFFSET
public const NETWORK_Y_OFFSET = 0.375Network position of a boat: Bedrock clients place boats by a point 0.375 above their bottom.
OUT_OF_CONTROL_TICKS
public const OUT_OF_CONTROL_TICKS = 60Ticks under water after which the passengers are thrown out.
PADDLE_SPEED
public const PADDLE_SPEED = \M_PI / 8Phase advanced by a moving paddle per tick, in radians (vanilla PADDLE_SPEED).
TAG_VARIANT
public const TAG_VARIANT = "Variant"Properties
$damage protected
protected float $damage$hurtDirection protected
protected int $hurtDirection$hurtTime protected
protected int $hurtTime$variant protected
protected \pocketmine\entity\vehicle\BoatVariant $variantMethods
animateHurt() protected
protected function animateHurt() : voidattack()
public function attack(\pocketmine\event\entity\EntityDamageEvent $source) : voidbreakBoat()
public function breakBoat(bool $drops) : voidBreaks the boat: drops its item (if $drops) and removes it. A chest boat drops its contents in any case.
broadcastMovement() protected
protected function broadcastMovement(bool $teleport = false) : voidcanAddPassenger()
public function canAddPassenger(\pocketmine\entity\Entity $entity) : boolcanBeDamagedBy() protected
protected function canBeDamagedBy(\pocketmine\event\entity\EntityDamageEvent $source) : boolWhether this kind of damage hurts boats: hits, projectiles, explosions and lava (Bedrock hurt_on_condition), not fire, falls, drowning...
canBeRiddenBy()
public function canBeRiddenBy(\pocketmine\entity\Entity $entity) : boolcanBeStoodOn()
public function canBeStoodOn() : boolcanPickUp() protected
protected function canPickUp(\pocketmine\entity\Entity $entity) : boolWhether the entity gets in this boat when they bump into each other.
entityBaseTick() protected
protected function entityBaseTick(int $tickDiff = 1) : boolgetBoatDrops()
public function getBoatDrops() : arrayReturns the items dropped by the boat when it breaks (container contents are dropped separately).
getBoatItem()
public function getBoatItem() : \pocketmine\item\ItemReturns the item this boat drops when broken (and that picks it).
getControllingPassenger()
public function getControllingPassenger() : ?\pocketmine\entity\EntitygetDamage()
public function getDamage() : floatReturns the accumulated damage (the boat breaks above Boat::BREAK_DAMAGE).
getForwardDirection()
public function getForwardDirection() : \pocketmine\math\Vector3Direction the boat moves when paddling forwards (its Bedrock yaw minus 90 degrees).
getHeadYaw()
public function getHeadYaw() : floatgetHurtDirection()
public function getHurtDirection() : intgetHurtTime()
public function getHurtTime() : intgetInitialDragMultiplier() protected
protected function getInitialDragMultiplier() : floatgetInitialGravity() protected
protected function getInitialGravity() : floatgetInitialSizeInfo() protected
protected function getInitialSizeInfo() : \pocketmine\entity\EntitySizeInfogetInteractButtonText()
public function getInteractButtonText(\pocketmine\player\Player $player) : stringgetName()
public function getName() : stringgetNetworkTypeId()
public static function getNetworkTypeId() : stringgetOffsetPosition()
public function getOffsetPosition(\pocketmine\math\Vector3 $vector3) : \pocketmine\math\Vector3getPaddleTime()
public function getPaddleTime(bool $left) : floatReturns the animation phase of a paddle in radians (0 when it doesn't move).
getPassengerPosition()
public function getPassengerPosition(\pocketmine\entity\Entity $passenger) : \pocketmine\math\Vector3getPickedItem()
public function getPickedItem() : ?\pocketmine\item\ItemgetRideableSeats()
public function getRideableSeats() : arraygetRiderRotation() protected
protected function getRiderRotation(int $seat) : floatVanilla rotate_rider_by of a seat shared by two riders: people and monsters face forwards (-90), animals sit across the boat.
getVariant()
public function getVariant() : \pocketmine\entity\vehicle\BoatVarianthandleClientVehicleMovement()
public function handleClientVehicleMovement(\pocketmine\player\Player $rider, \pocketmine\math\Vector3 $pos, float $yaw, float $pitch) : boolCalled 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()
public function handleRiderInput(\pocketmine\player\Player $rider, \pocketmine\entity\riding\RiderInput $input) : voidCalled every tick with the input of the player steering this boat.
hasMovementUpdate()
public function hasMovementUpdate() : boolinitEntity() protected
protected function initEntity(\pocketmine\nbt\tag\CompoundTag $nbt) : voidisBroken()
public function isBroken() : boolisMovedByClient()
public function isMovedByClient() : boolReturns 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
protected function move(float $dx, float $dy, float $dz) : voidonDeathUpdate() protected
protected function onDeathUpdate(int $tickDiff) : boolonInteract()
public function onInteract(\pocketmine\player\Player $player, \pocketmine\math\Vector3 $clickPos) : boolonPassengerAdded() protected
protected function onPassengerAdded(\pocketmine\entity\Entity $passenger) : voidonPassengerRemoved() protected
protected function onPassengerRemoved(\pocketmine\entity\Entity $passenger) : voidpushAndPickupEntities() protected
protected function pushAndPickupEntities() : voidVanilla 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()
public function resyncClientVehicle(\pocketmine\player\Player $rider) : voidSends the boat's position to the client of its driver, which moved it somewhere it was not allowed to go.
saveNBT()
public function saveNBT() : \pocketmine\nbt\tag\CompoundTagsetDamage()
public function setDamage(float $damage) : voidsetVariant()
public function setVariant(\pocketmine\entity\vehicle\BoatVariant $variant) : voidsyncNetworkData() protected
protected function syncNetworkData(\pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection $properties) : voidtryChangeMovement() protected
protected function tryChangeMovement() : voidupdateFallState() protected
protected function updateFallState(float $distanceThisTick, bool $onGround) : ?float