Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing world border boolean to use item on packet in 1.21.2 #192

Merged
merged 1 commit into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions azalea-client/src/interact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -144,6 +145,7 @@ pub fn handle_block_interact_event(
direction: Direction::Up,
location: event.position.center(),
inside: false,
world_border: false,
}
};

Expand Down
1 change: 1 addition & 0 deletions azalea-core/src/aabb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ impl AABB {
block_pos: *pos,
inside: false,
miss: false,
world_border: false,
})
}

Expand Down
2 changes: 2 additions & 0 deletions azalea-core/src/block_hit_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub struct BlockHitResult {
pub block_pos: BlockPos,
pub miss: bool,
pub inside: bool,
pub world_border: bool,
}

impl BlockHitResult {
Expand All @@ -20,6 +21,7 @@ impl BlockHitResult {
block_pos,
miss: true,
inside: false,
world_border: false,
}
}

Expand Down
1 change: 1 addition & 0 deletions azalea-physics/src/collision/shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion azalea-protocol/src/packets/game/s_use_item_on.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -48,6 +50,7 @@ impl AzaleaWrite for BlockHit {
buf,
)?;
self.inside.azalea_write(buf)?;
self.world_border.azalea_write(buf)?;
Ok(())
}
}
Expand All @@ -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,
Expand All @@ -69,6 +73,7 @@ impl AzaleaRead for BlockHit {
z: f64::from(block_pos.z) + f64::from(cursor_z),
},
inside,
world_border,
})
}
}
Loading