server: fix block placement in 1.16 (#512)

* fix block placement in 1.16

* fmt
This commit is contained in:
Kezi 2021-03-04 04:34:36 +01:00 committed by GitHub
parent e3845a0dbf
commit 8cecbb37e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 1 deletions

View File

@ -797,7 +797,27 @@ impl Server {
renderer.view_vector.cast().unwrap(),
target::test_block,
) {
if self.protocol_version >= 315 {
if self.protocol_version >= 477 {
self.write_packet(
packet::play::serverbound::PlayerBlockPlacement_insideblock {
location: pos,
face: protocol::VarInt(match face {
Direction::Down => 0,
Direction::Up => 1,
Direction::North => 2,
Direction::South => 3,
Direction::West => 4,
Direction::East => 5,
_ => unreachable!(),
}),
hand: protocol::VarInt(0),
cursor_x: at.x as f32,
cursor_y: at.y as f32,
cursor_z: at.z as f32,
inside_block: false,
},
);
} else if self.protocol_version >= 315 {
self.write_packet(packet::play::serverbound::PlayerBlockPlacement_f32 {
location: pos,
face: protocol::VarInt(match face {