Files
Pumpkin/pumpkin-protocol/src/java/server/play/mod.rs
Richard Marshall b77d9c1b4d feat: complete boat implementation (#1440)
* feat: implement boat placement

- add boat item handler for all boat/raft types
- raycast with fluid handling to place on water or blocks
- filter entities with can_hit predicate (vanilla parity)
- check space is empty before spawning
- decrement item unless creative mode

* feat: add boat entity with damage handling

- create BoatEntity struct implementing EntityBase
- implement can_hit() and is_collidable() for boats
- implement damage handling that drops boat item on destroy
- update boat item to spawn BoatEntity instead of generic Entity

* fix: boat damage wobble and attack sounds match vanilla

Boats now accumulate damage with wobble animation that decays over time.
Attack sounds play for all hittable entities, not just living entities.

* feat: add boat riding and vehicle movement packets

* feat: complete boat implementation matching vanilla

- add underwater check (60 ticks) and max 2 passengers limit
- add paddle animation metadata and handler
- implement proper land dismount with offset calculation
- add riding_cooldown field to entity

* fix: clippy warnings for boat implementation

* refactor: use loot tables for boat item drops

* fix: collapse nested if to satisfy clippy

* style: fix cargo fmt formatting for collapsible if

* fix: boat dismount places player correctly beside vehicle

- implement vanilla's dismount position calculation with
  getDismountHeight, canDismountInBlock, and pose fallback
  (standing → crouching → swimming)
- fix packet ordering race: use enqueue_packet for teleport so it
  arrives after CSetPassengers (send_packet_now bypassed the queue)
- pre-set awaiting_teleport before CSetPassengers to block stale
  movement packets during async dismount calculation
- send CSetPassengers directly to dismounting player, broadcast to
  others (matching vanilla's targeted packet behavior)
- use DELTA|ROT position flags for teleport (vanilla preserves
  current look direction with relative rotation)
- add riding cooldown (60 ticks) to prevent immediate re-mount
- reset sneaking state after player dismount
- fix water detection to check specifically for water/flowing_water
  fluids (Fluid::from_state_id returns EMPTY for air blocks)
- revert broken loot table refactor for boat item drops (boats use
  hardcoded entity-to-item mapping, not loot tables)
- add get_dismount_height helper on World matching vanilla's
  BlockView.getDismountHeight()
- ignore movement packets while awaiting teleport confirmation in
  handle_position and handle_position_rotation

* style: fix cargo fmt formatting

* refactor: use loot tables for boat item drops

add loot table entries to entities.json for all 20 boat/raft types
and use the existing loot table system instead of hardcoded mapping.

* fix: resolve rebase conflicts and clippy warnings

* fix: regenerate codegen to include boat loot tables
2026-02-17 19:47:49 +00:00

74 lines
1.6 KiB
Rust

mod change_game_mode;
mod chat_command;
mod chat_message;
mod chunk_batch;
mod click_container;
mod client_command;
mod client_information;
mod client_tick_end;
mod close_container;
mod command_suggestion;
mod confirm_teleport;
mod cookie_response;
mod custom_payload;
mod interact;
mod keep_alive;
mod move_vehicle;
mod paddle_boat;
mod pick_item;
mod ping_request;
mod player_abilities;
mod player_action;
mod player_command;
mod player_ground;
mod player_input;
mod player_loaded;
mod player_position;
mod player_position_rotation;
mod player_rotation;
mod player_session;
mod set_command_block;
mod set_creative_slot;
mod set_held_item;
mod swing_arm;
mod update_sign;
mod use_item;
mod use_item_on;
pub use change_game_mode::*;
pub use chat_command::*;
pub use chat_message::*;
pub use chunk_batch::*;
pub use click_container::*;
pub use client_command::*;
pub use client_information::*;
pub use client_tick_end::*;
pub use close_container::*;
pub use command_suggestion::*;
pub use confirm_teleport::*;
pub use cookie_response::*;
pub use custom_payload::*;
pub use interact::*;
pub use keep_alive::*;
pub use move_vehicle::*;
pub use paddle_boat::*;
pub use pick_item::*;
pub use ping_request::*;
pub use player_abilities::*;
pub use player_action::*;
pub use player_command::*;
pub use player_ground::*;
pub use player_input::*;
pub use player_loaded::*;
pub use player_position::*;
pub use player_position_rotation::*;
pub use player_rotation::*;
pub use player_session::*;
pub use set_command_block::*;
pub use set_creative_slot::*;
pub use set_held_item::*;
pub use swing_arm::*;
pub use update_sign::*;
pub use use_item::*;
pub use use_item_on::*;