pub fn handle_player_block_placement(
    game: &Game,
    server: &mut Server,
    packet: PlayerBlockPlacement,
    player: EntityRef,
) -> SysResult {
    let position = match packet.face {
        BlockFace::Bottom => packet.position.down(),
        BlockFace::Top => packet.position.up(),
        BlockFace::North => packet.position.north(),
        BlockFace::South => packet.position.south(),
        BlockFace::West => packet.position.west(),
        BlockFace::East => packet.position.east(),
    };

    log::trace!("Got player block placement at {:?}", position);

    let client = server.clients.get(*player.get::<ClientId>()?).unwrap();
    let block_id = game.block(position).unwrap_or_default();

    client.send_block_change(position, block_id);
    Ok(())
}
/// Handles the player block placement packet. Currently just removes the block client side for the player.
Handles the player block placement packet. Currently just removes the block client side for the player.
Handles the player block placement packet . Currently just removes the block client side for the player .
pub fn handle_player_block_placement(
    game: &Game,
    server: &mut Server,
    packet: PlayerBlockPlacement,
    player: EntityRef,
) -> SysResult {
    let position = match packet.face {
        BlockFace::Bottom => packet.position.down(),
        BlockFace::Top => packet.position.up(),
        BlockFace::North => packet.position.north(),
        BlockFace::South => packet.position.south(),
        BlockFace::West => packet.position.west(),
        BlockFace::East => packet.position.east(),
    };
    log::trace!("Got player block placement at {:?}", position);
    let client = server.clients.get(*player.get::<ClientId>()?).unwrap();
    let block_id = game.block(position).unwrap_or_default();
    client.send_block_change(position, block_id);
    Ok(())
}
pub fn handle_player_block_placement ( game : & Game , server : & mut Server , packet : PlayerBlockPlacement , player : EntityRef , ) -> SysResult { let position = match packet . face { BlockFace :: Bottom => packet . position . down ( ) , BlockFace :: Top => packet . position . up ( ) , BlockFace :: North => packet . position . north ( ) , BlockFace :: South => packet . position . south ( ) , BlockFace :: West => packet . position . west ( ) , BlockFace :: East => packet . position . east ( ) , } ; log :: trace ! ( " " position ) ; let client = server . clients . get ( * player . get :: < ClientId > ( ) ? ) . unwrap ( ) ; let block_id = game . block ( position ) . unwrap_or_default ( ) ; client . send_block_change ( position , block_id ) ; Ok ( ( ) ) }
Handles the player block placement packet.
Handles the player block placement packet .
game
&Game
server
&mut Server
packet
PlayerBlockPlacement
player
EntityRef
game
&Game
server
&mut Server
packet
PlayerBlockPlacement
player
EntityRef