mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
Add missing world border boolean to use item on packet in 1.21.2 (#192)
This commit is contained in:
parent
944fe5c6f8
commit
ea5a1c1ec1
5 changed files with 12 additions and 1 deletions
|
@ -136,6 +136,7 @@ pub fn handle_block_interact_event(
|
||||||
direction: hit_result.direction,
|
direction: hit_result.direction,
|
||||||
location: hit_result.location,
|
location: hit_result.location,
|
||||||
inside: hit_result.inside,
|
inside: hit_result.inside,
|
||||||
|
world_border: hit_result.world_border,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// we're not looking at the block, so make up some numbers
|
// 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,
|
direction: Direction::Up,
|
||||||
location: event.position.center(),
|
location: event.position.center(),
|
||||||
inside: false,
|
inside: false,
|
||||||
|
world_border: false,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -260,6 +260,7 @@ impl AABB {
|
||||||
block_pos: *pos,
|
block_pos: *pos,
|
||||||
inside: false,
|
inside: false,
|
||||||
miss: false,
|
miss: false,
|
||||||
|
world_border: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ pub struct BlockHitResult {
|
||||||
pub block_pos: BlockPos,
|
pub block_pos: BlockPos,
|
||||||
pub miss: bool,
|
pub miss: bool,
|
||||||
pub inside: bool,
|
pub inside: bool,
|
||||||
|
pub world_border: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BlockHitResult {
|
impl BlockHitResult {
|
||||||
|
@ -20,6 +21,7 @@ impl BlockHitResult {
|
||||||
block_pos,
|
block_pos,
|
||||||
miss: true,
|
miss: true,
|
||||||
inside: false,
|
inside: false,
|
||||||
|
world_border: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -439,6 +439,7 @@ impl VoxelShape {
|
||||||
location: right_after_start,
|
location: right_after_start,
|
||||||
inside: true,
|
inside: true,
|
||||||
miss: false,
|
miss: false,
|
||||||
|
world_border: false,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
AABB::clip_iterable(&self.to_aabbs(), from, to, block_pos)
|
AABB::clip_iterable(&self.to_aabbs(), from, to, block_pos)
|
||||||
|
|
|
@ -27,8 +27,10 @@ pub struct BlockHit {
|
||||||
/// network, this is transmitted as the difference between the location and
|
/// network, this is transmitted as the difference between the location and
|
||||||
/// block position.
|
/// block position.
|
||||||
pub location: Vec3,
|
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,
|
pub inside: bool,
|
||||||
|
/// Whether the player's hitting the world border.
|
||||||
|
pub world_border: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AzaleaWrite for BlockHit {
|
impl AzaleaWrite for BlockHit {
|
||||||
|
@ -48,6 +50,7 @@ impl AzaleaWrite for BlockHit {
|
||||||
buf,
|
buf,
|
||||||
)?;
|
)?;
|
||||||
self.inside.azalea_write(buf)?;
|
self.inside.azalea_write(buf)?;
|
||||||
|
self.world_border.azalea_write(buf)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,6 +63,7 @@ impl AzaleaRead for BlockHit {
|
||||||
let cursor_y = f32::azalea_read(buf)?;
|
let cursor_y = f32::azalea_read(buf)?;
|
||||||
let cursor_z = f32::azalea_read(buf)?;
|
let cursor_z = f32::azalea_read(buf)?;
|
||||||
let inside = bool::azalea_read(buf)?;
|
let inside = bool::azalea_read(buf)?;
|
||||||
|
let world_border = bool::azalea_read(buf)?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
block_pos,
|
block_pos,
|
||||||
direction,
|
direction,
|
||||||
|
@ -69,6 +73,7 @@ impl AzaleaRead for BlockHit {
|
||||||
z: f64::from(block_pos.z) + f64::from(cursor_z),
|
z: f64::from(block_pos.z) + f64::from(cursor_z),
|
||||||
},
|
},
|
||||||
inside,
|
inside,
|
||||||
|
world_border,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue