aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShayne Hartford <shaybox@shaybox.com>2024-11-30 19:05:35 -0500
committerGitHub <noreply@github.com>2024-11-30 18:05:35 -0600
commitea5a1c1ec128cc1a33593c9d91ef758c3fb73e16 (patch)
treea118ec0a95af962da70d5df7ad1028813d2883a1
parent944fe5c6f888ebdcb7354cc5e6ab6a7414daec99 (diff)
downloadazalea-drasl-ea5a1c1ec128cc1a33593c9d91ef758c3fb73e16.tar.xz
Add missing world border boolean to use item on packet in 1.21.2 (#192)
-rw-r--r--azalea-client/src/interact.rs2
-rwxr-xr-xazalea-core/src/aabb.rs1
-rwxr-xr-xazalea-core/src/block_hit_result.rs2
-rwxr-xr-xazalea-physics/src/collision/shape.rs1
-rwxr-xr-xazalea-protocol/src/packets/game/s_use_item_on.rs7
5 files changed, 12 insertions, 1 deletions
diff --git a/azalea-client/src/interact.rs b/azalea-client/src/interact.rs
index 0acc6992..e11873ae 100644
--- a/azalea-client/src/interact.rs
+++ b/azalea-client/src/interact.rs
@@ -136,6 +136,7 @@ pub fn handle_block_interact_event(
direction: hit_result.direction,
location: hit_result.location,
inside: hit_result.inside,
+ world_border: hit_result.world_border,
}
} else {
// we're not looking at the block, so make up some numbers
@@ -144,6 +145,7 @@ pub fn handle_block_interact_event(
direction: Direction::Up,
location: event.position.center(),
inside: false,
+ world_border: false,
}
};
diff --git a/azalea-core/src/aabb.rs b/azalea-core/src/aabb.rs
index 61b015cb..70829aa2 100755
--- a/azalea-core/src/aabb.rs
+++ b/azalea-core/src/aabb.rs
@@ -260,6 +260,7 @@ impl AABB {
block_pos: *pos,
inside: false,
miss: false,
+ world_border: false,
})
}
diff --git a/azalea-core/src/block_hit_result.rs b/azalea-core/src/block_hit_result.rs
index 20cc723b..4d930453 100755
--- a/azalea-core/src/block_hit_result.rs
+++ b/azalea-core/src/block_hit_result.rs
@@ -10,6 +10,7 @@ pub struct BlockHitResult {
pub block_pos: BlockPos,
pub miss: bool,
pub inside: bool,
+ pub world_border: bool,
}
impl BlockHitResult {
@@ -20,6 +21,7 @@ impl BlockHitResult {
block_pos,
miss: true,
inside: false,
+ world_border: false,
}
}
diff --git a/azalea-physics/src/collision/shape.rs b/azalea-physics/src/collision/shape.rs
index 3f584952..e7ac9c2e 100755
--- a/azalea-physics/src/collision/shape.rs
+++ b/azalea-physics/src/collision/shape.rs
@@ -439,6 +439,7 @@ impl VoxelShape {
location: right_after_start,
inside: true,
miss: false,
+ world_border: false,
})
} else {
AABB::clip_iterable(&self.to_aabbs(), from, to, block_pos)
diff --git a/azalea-protocol/src/packets/game/s_use_item_on.rs b/azalea-protocol/src/packets/game/s_use_item_on.rs
index 0ad23ad2..4c87cb72 100755
--- a/azalea-protocol/src/packets/game/s_use_item_on.rs
+++ b/azalea-protocol/src/packets/game/s_use_item_on.rs
@@ -27,8 +27,10 @@ pub struct BlockHit {
/// network, this is transmitted as the difference between the location and
/// block position.
pub location: Vec3,
- /// Whether the player's head is inside of a block.
+ /// Whether the player's head is inside a block.
pub inside: bool,
+ /// Whether the player's hitting the world border.
+ pub world_border: bool,
}
impl AzaleaWrite for BlockHit {
@@ -48,6 +50,7 @@ impl AzaleaWrite for BlockHit {
buf,
)?;
self.inside.azalea_write(buf)?;
+ self.world_border.azalea_write(buf)?;
Ok(())
}
}
@@ -60,6 +63,7 @@ impl AzaleaRead for BlockHit {
let cursor_y = f32::azalea_read(buf)?;
let cursor_z = f32::azalea_read(buf)?;
let inside = bool::azalea_read(buf)?;
+ let world_border = bool::azalea_read(buf)?;
Ok(Self {
block_pos,
direction,
@@ -69,6 +73,7 @@ impl AzaleaRead for BlockHit {
z: f64::from(block_pos.z) + f64::from(cursor_z),
},
inside,
+ world_border,
})
}
}