1use std::{cmp, num::NonZeroU32, sync::LazyLock};
2
3use azalea_core::{
4 direction::{Axis, AxisCycle, Direction},
5 hit_result::BlockHitResult,
6 math::{EPSILON, binary_search},
7 position::{BlockPos, Vec3, Vec3i},
8};
9
10use super::mergers::IndexMerger;
11use crate::collision::{Aabb, BitSetDiscreteVoxelShape, DiscreteVoxelShape};
12
13pub struct Shapes;
14
15pub static BLOCK_SHAPE: LazyLock<VoxelShape> = LazyLock::new(|| {
16 let mut shape = BitSetDiscreteVoxelShape::new(1, 1, 1);
17 shape.fill(0, 0, 0);
18 VoxelShape::Cube(CubeVoxelShape::new(DiscreteVoxelShape::BitSet(shape)))
19});
20
21pub fn box_shape(
22 min_x: f64,
23 min_y: f64,
24 min_z: f64,
25 max_x: f64,
26 max_y: f64,
27 max_z: f64,
28) -> VoxelShape {
29 if max_x - min_x < EPSILON && max_y - min_y < EPSILON && max_z - min_z < EPSILON {
33 return EMPTY_SHAPE.clone();
34 }
35
36 let x_bits = find_bits(min_x, max_x);
37 let y_bits = find_bits(min_y, max_y);
38 let z_bits = find_bits(min_z, max_z);
39
40 if x_bits < 0 || y_bits < 0 || z_bits < 0 {
41 return VoxelShape::Array(ArrayVoxelShape::new(
42 BLOCK_SHAPE.shape().to_owned(),
43 vec![min_x, max_x],
44 vec![min_y, max_y],
45 vec![min_z, max_z],
46 ));
47 }
48 if x_bits == 0 && y_bits == 0 && z_bits == 0 {
49 return BLOCK_SHAPE.clone();
50 }
51
52 let x_bits = 1 << x_bits;
53 let y_bits = 1 << y_bits;
54 let z_bits = 1 << z_bits;
55 let shape = BitSetDiscreteVoxelShape::with_filled_bounds(
56 x_bits,
57 y_bits,
58 z_bits,
59 Vec3i {
60 x: (min_x * x_bits as f64).round() as i32,
61 y: (min_y * y_bits as f64).round() as i32,
62 z: (min_z * z_bits as f64).round() as i32,
63 },
64 Vec3i {
65 x: (max_x * x_bits as f64).round() as i32,
66 y: (max_y * y_bits as f64).round() as i32,
67 z: (max_z * z_bits as f64).round() as i32,
68 },
69 );
70 VoxelShape::Cube(CubeVoxelShape::new(DiscreteVoxelShape::BitSet(shape)))
71}
72
73pub static EMPTY_SHAPE: LazyLock<VoxelShape> = LazyLock::new(|| {
74 VoxelShape::Array(ArrayVoxelShape::new(
75 DiscreteVoxelShape::BitSet(BitSetDiscreteVoxelShape::new(0, 0, 0)),
76 vec![0.],
77 vec![0.],
78 vec![0.],
79 ))
80});
81
82fn find_bits(min: f64, max: f64) -> i32 {
83 if min < -EPSILON || max > 1. + EPSILON {
84 return -1;
85 }
86 for bits in 0..=3 {
87 let shifted_bits = 1 << bits;
88 let min = min * shifted_bits as f64;
89 let max = max * shifted_bits as f64;
90 let min_ok = (min - min.round()).abs() < EPSILON * shifted_bits as f64;
91 let max_ok = (max - max.round()).abs() < EPSILON * shifted_bits as f64;
92 if min_ok && max_ok {
93 return bits;
94 }
95 }
96 -1
97}
98
99impl Shapes {
100 pub fn or(a: VoxelShape, b: VoxelShape) -> VoxelShape {
101 Self::join(a, b, |a, b| a || b)
102 }
103
104 pub fn collide(
105 axis: Axis,
106 entity_box: &Aabb,
107 collision_boxes: &[VoxelShape],
108 mut movement: f64,
109 ) -> f64 {
110 for shape in collision_boxes {
111 if movement.abs() < EPSILON {
112 return 0.;
113 }
114 movement = shape.collide(axis, entity_box, movement);
115 }
116 movement
117 }
118
119 pub fn join(a: VoxelShape, b: VoxelShape, op: fn(bool, bool) -> bool) -> VoxelShape {
120 Self::join_unoptimized(a, b, op).optimize()
121 }
122
123 pub fn join_unoptimized(
124 a: VoxelShape,
125 b: VoxelShape,
126 op: fn(bool, bool) -> bool,
127 ) -> VoxelShape {
128 if op(false, false) {
129 panic!("Illegal operation");
130 };
131 let op_true_false = op(true, false);
135 let op_false_true = op(false, true);
136 if a.is_empty() {
137 return if op_false_true {
138 b
139 } else {
140 EMPTY_SHAPE.clone()
141 };
142 }
143 if b.is_empty() {
144 return if op_true_false {
145 a
146 } else {
147 EMPTY_SHAPE.clone()
148 };
149 }
150 let var5 = Self::create_index_merger(
162 1,
163 a.get_coords(Axis::X),
164 b.get_coords(Axis::X),
165 op_true_false,
166 op_false_true,
167 );
168 let var6 = Self::create_index_merger(
169 (var5.size() - 1).try_into().unwrap(),
170 a.get_coords(Axis::Y),
171 b.get_coords(Axis::Y),
172 op_true_false,
173 op_false_true,
174 );
175 let var7 = Self::create_index_merger(
176 ((var5.size() - 1) * (var6.size() - 1)).try_into().unwrap(),
177 a.get_coords(Axis::Z),
178 b.get_coords(Axis::Z),
179 op_true_false,
180 op_false_true,
181 );
182 let var8 = BitSetDiscreteVoxelShape::join(a.shape(), b.shape(), &var5, &var6, &var7, op);
183 if matches!(var5, IndexMerger::DiscreteCube { .. })
186 && matches!(var6, IndexMerger::DiscreteCube { .. })
187 && matches!(var7, IndexMerger::DiscreteCube { .. })
188 {
189 VoxelShape::Cube(CubeVoxelShape::new(DiscreteVoxelShape::BitSet(var8)))
190 } else {
191 VoxelShape::Array(ArrayVoxelShape::new(
192 DiscreteVoxelShape::BitSet(var8),
193 var5.get_list(),
194 var6.get_list(),
195 var7.get_list(),
196 ))
197 }
198 }
199
200 pub fn matches_anywhere(
203 a: &VoxelShape,
204 b: &VoxelShape,
205 op: impl Fn(bool, bool) -> bool,
206 ) -> bool {
207 debug_assert!(!op(false, false));
208 let a_is_empty = a.is_empty();
209 let b_is_empty = b.is_empty();
210 if a_is_empty || b_is_empty {
211 return op(!a_is_empty, !b_is_empty);
212 }
213 if a == b {
214 return op(true, true);
215 }
216
217 let op_true_false = op(true, false);
218 let op_false_true = op(false, true);
219
220 for axis in [Axis::X, Axis::Y, Axis::Z] {
221 if a.max(axis) < b.min(axis) - EPSILON {
222 return op_true_false || op_false_true;
223 }
224 if b.max(axis) < a.min(axis) - EPSILON {
225 return op_true_false || op_false_true;
226 }
227 }
228
229 let x_merger = Self::create_index_merger(
230 1,
231 a.get_coords(Axis::X),
232 b.get_coords(Axis::X),
233 op_true_false,
234 op_false_true,
235 );
236 let y_merger = Self::create_index_merger(
237 (x_merger.size() - 1) as i32,
238 a.get_coords(Axis::Y),
239 b.get_coords(Axis::Y),
240 op_true_false,
241 op_false_true,
242 );
243 let z_merger = Self::create_index_merger(
244 ((x_merger.size() - 1) * (y_merger.size() - 1)) as i32,
245 a.get_coords(Axis::Z),
246 b.get_coords(Axis::Z),
247 op_true_false,
248 op_false_true,
249 );
250
251 Self::matches_anywhere_with_mergers(
252 x_merger,
253 y_merger,
254 z_merger,
255 a.shape().to_owned(),
256 b.shape().to_owned(),
257 op,
258 )
259 }
260
261 pub fn matches_anywhere_with_mergers(
262 merged_x: IndexMerger,
263 merged_y: IndexMerger,
264 merged_z: IndexMerger,
265 shape1: DiscreteVoxelShape,
266 shape2: DiscreteVoxelShape,
267 op: impl Fn(bool, bool) -> bool,
268 ) -> bool {
269 !merged_x.for_merged_indexes(|x, x2, _x3| {
270 merged_y.for_merged_indexes(|y, y2, _y3| {
271 merged_z.for_merged_indexes(|z, z2, _z3| {
272 !op(
273 shape1.is_full_wide(Vec3i::new(x, y, z)),
274 shape2.is_full_wide(Vec3i::new(x2, y2, z2)),
275 )
276 })
277 })
278 })
279 }
280
281 pub fn create_index_merger(
282 _var0: i32,
283 coords1: &[f64],
284 coords2: &[f64],
285 var3: bool,
286 var4: bool,
287 ) -> IndexMerger {
288 let var5 = coords1.len() - 1;
289 let var6 = coords2.len() - 1;
290 if coords1[var5] < coords2[0] - EPSILON {
301 IndexMerger::NonOverlapping {
302 lower: coords1.to_vec(),
303 upper: coords2.to_vec(),
304 swap: false,
305 }
306 } else if coords2[var6] < coords1[0] - EPSILON {
307 IndexMerger::NonOverlapping {
308 lower: coords2.to_vec(),
309 upper: coords1.to_vec(),
310 swap: true,
311 }
312 } else if var5 == var6 && coords1 == coords2 {
313 IndexMerger::Identical {
314 coords: coords1.to_vec(),
315 }
316 } else {
317 IndexMerger::new_indirect(coords1, coords2, var3, var4)
318 }
319 }
320}
321
322#[derive(Clone, PartialEq, Debug)]
323pub enum VoxelShape {
324 Array(ArrayVoxelShape),
325 Cube(CubeVoxelShape),
326}
327
328impl VoxelShape {
329 fn min(&self, axis: Axis) -> f64 {
338 let first_full = self.shape().first_full(axis);
339 if first_full >= self.shape().size(axis) as i32 {
340 f64::INFINITY
341 } else {
342 self.get(axis, first_full.try_into().unwrap())
343 }
344 }
345 fn max(&self, axis: Axis) -> f64 {
346 let last_full = self.shape().last_full(axis);
347 if last_full <= 0 {
348 f64::NEG_INFINITY
349 } else {
350 self.get(axis, last_full.try_into().unwrap())
351 }
352 }
353
354 pub fn shape(&self) -> &DiscreteVoxelShape {
355 match self {
356 VoxelShape::Array(s) => s.shape(),
357 VoxelShape::Cube(s) => s.shape(),
358 }
359 }
360
361 pub fn get_coords(&self, axis: Axis) -> &[f64] {
362 match self {
363 VoxelShape::Array(s) => s.get_coords(axis),
364 VoxelShape::Cube(s) => s.get_coords(axis),
365 }
366 }
367
368 pub fn is_empty(&self) -> bool {
369 self.shape().is_empty()
370 }
371
372 #[must_use]
373 pub fn move_relative(&self, delta: Vec3) -> VoxelShape {
374 if self.shape().is_empty() {
375 return EMPTY_SHAPE.clone();
376 }
377
378 VoxelShape::Array(ArrayVoxelShape::new(
379 self.shape().to_owned(),
380 self.get_coords(Axis::X)
381 .iter()
382 .map(|c| c + delta.x)
383 .collect(),
384 self.get_coords(Axis::Y)
385 .iter()
386 .map(|c| c + delta.y)
387 .collect(),
388 self.get_coords(Axis::Z)
389 .iter()
390 .map(|c| c + delta.z)
391 .collect(),
392 ))
393 }
394
395 #[inline]
396 pub fn get(&self, axis: Axis, index: usize) -> f64 {
397 match self {
399 VoxelShape::Array(s) => s.get_coords(axis)[index],
400 VoxelShape::Cube(s) => s.get_coords(axis)[index],
401 }
403 }
404
405 pub fn find_index(&self, axis: Axis, coord: f64) -> i32 {
406 match self {
407 VoxelShape::Cube(s) => s.find_index(axis, coord),
408 _ => {
409 let upper_limit = (self.shape().size(axis) + 1) as i32;
410 binary_search(0, upper_limit, |t| coord < self.get(axis, t as usize)) - 1
411 }
412 }
413 }
414
415 pub fn clip(&self, from: Vec3, to: Vec3, block_pos: BlockPos) -> Option<BlockHitResult> {
416 if self.is_empty() {
417 return None;
418 }
419 let vector = to - from;
420 if vector.length_squared() < EPSILON {
421 return None;
422 }
423 let right_after_start = from + (vector * 0.001);
424
425 if self.shape().is_full_wide(Vec3i::new(
426 self.find_index(Axis::X, right_after_start.x - block_pos.x as f64),
427 self.find_index(Axis::Y, right_after_start.y - block_pos.y as f64),
428 self.find_index(Axis::Z, right_after_start.z - block_pos.z as f64),
429 )) {
430 Some(BlockHitResult {
431 block_pos,
432 direction: Direction::nearest(vector).opposite(),
433 location: right_after_start,
434 inside: true,
435 miss: false,
436 world_border: false,
437 })
438 } else {
439 Aabb::clip_iterable(&self.to_aabbs(), from, to, block_pos)
440 }
441 }
442
443 pub fn collide(&self, axis: Axis, entity_box: &Aabb, movement: f64) -> f64 {
444 self.collide_x(AxisCycle::between(axis, Axis::X), entity_box, movement)
445 }
446 pub fn collide_x(&self, axis_cycle: AxisCycle, entity_box: &Aabb, mut movement: f64) -> f64 {
447 if self.shape().is_empty() {
448 return movement;
449 }
450 if movement.abs() < EPSILON {
451 return 0.;
452 }
453
454 let inverse_axis_cycle = axis_cycle.inverse();
455
456 let x_axis = inverse_axis_cycle.cycle(Axis::X);
457 let y_axis = inverse_axis_cycle.cycle(Axis::Y);
458 let z_axis = inverse_axis_cycle.cycle(Axis::Z);
459
460 let max_x = entity_box.max(&x_axis);
461 let min_x = entity_box.min(&x_axis);
462
463 let x_min_index = self.find_index(x_axis, min_x + EPSILON);
464 let x_max_index = self.find_index(x_axis, max_x - EPSILON);
465
466 let y_min_index = cmp::max(
467 0,
468 self.find_index(y_axis, entity_box.min(&y_axis) + EPSILON),
469 );
470 let y_max_index = cmp::min(
471 self.shape().size(y_axis) as i32,
472 self.find_index(y_axis, entity_box.max(&y_axis) - EPSILON) + 1,
473 );
474
475 let z_min_index = cmp::max(
476 0,
477 self.find_index(z_axis, entity_box.min(&z_axis) + EPSILON),
478 );
479 let z_max_index = cmp::min(
480 self.shape().size(z_axis) as i32,
481 self.find_index(z_axis, entity_box.max(&z_axis) - EPSILON) + 1,
482 );
483
484 if movement > 0. {
485 for x in x_max_index + 1..(self.shape().size(x_axis) as i32) {
486 for y in y_min_index..y_max_index {
487 for z in z_min_index..z_max_index {
488 if self
489 .shape()
490 .is_full_wide_axis_cycle(inverse_axis_cycle, Vec3i { x, y, z })
491 {
492 let var23 = self.get(x_axis, x as usize) - max_x;
493 if var23 >= -EPSILON {
494 movement = f64::min(movement, var23);
495 }
496 return movement;
497 }
498 }
499 }
500 }
501 } else if movement < 0. && x_min_index > 0 {
502 for x in (0..x_min_index).rev() {
503 for y in y_min_index..y_max_index {
504 for z in z_min_index..z_max_index {
505 if self
506 .shape()
507 .is_full_wide_axis_cycle(inverse_axis_cycle, Vec3i { x, y, z })
508 {
509 let var23 = self.get(x_axis, (x + 1) as usize) - min_x;
510 if var23 <= EPSILON {
511 movement = f64::max(movement, var23);
512 }
513 return movement;
514 }
515 }
516 }
517 }
518 }
519
520 movement
521 }
522
523 fn optimize(&self) -> VoxelShape {
524 let mut shape = EMPTY_SHAPE.clone();
525 self.for_all_boxes(|var1x, var3, var5, var7, var9, var11| {
526 shape = Shapes::join_unoptimized(
527 shape.clone(),
528 box_shape(var1x, var3, var5, var7, var9, var11),
529 |a, b| a || b,
530 );
531 });
532 shape
533 }
534
535 pub fn for_all_boxes(&self, mut consumer: impl FnMut(f64, f64, f64, f64, f64, f64))
536 where
537 Self: Sized,
538 {
539 let x_coords = self.get_coords(Axis::X);
540 let y_coords = self.get_coords(Axis::Y);
541 let z_coords = self.get_coords(Axis::Z);
542 self.shape().for_all_boxes(
543 |min_x, min_y, min_z, max_x, max_y, max_z| {
544 consumer(
545 x_coords[min_x as usize],
546 y_coords[min_y as usize],
547 z_coords[min_z as usize],
548 x_coords[max_x as usize],
549 y_coords[max_y as usize],
550 z_coords[max_z as usize],
551 );
552 },
553 true,
554 );
555 }
556
557 pub fn to_aabbs(&self) -> Vec<Aabb> {
558 let mut aabbs = Vec::new();
559 self.for_all_boxes(|min_x, min_y, min_z, max_x, max_y, max_z| {
560 aabbs.push(Aabb {
561 min: Vec3::new(min_x, min_y, min_z),
562 max: Vec3::new(max_x, max_y, max_z),
563 });
564 });
565 aabbs
566 }
567
568 pub fn bounds(&self) -> Aabb {
569 assert!(!self.is_empty(), "Can't get bounds for empty shape");
570 Aabb {
571 min: Vec3::new(self.min(Axis::X), self.min(Axis::Y), self.min(Axis::Z)),
572 max: Vec3::new(self.max(Axis::X), self.max(Axis::Y), self.max(Axis::Z)),
573 }
574 }
575}
576
577impl From<&Aabb> for VoxelShape {
578 fn from(aabb: &Aabb) -> Self {
579 box_shape(
580 aabb.min.x, aabb.min.y, aabb.min.z, aabb.max.x, aabb.max.y, aabb.max.z,
581 )
582 }
583}
584impl From<Aabb> for VoxelShape {
585 fn from(aabb: Aabb) -> Self {
586 VoxelShape::from(&aabb)
587 }
588}
589
590#[derive(Clone, PartialEq, Debug)]
591pub struct ArrayVoxelShape {
592 shape: DiscreteVoxelShape,
593 #[allow(dead_code)]
595 faces: Option<Vec<VoxelShape>>,
596
597 pub xs: Vec<f64>,
598 pub ys: Vec<f64>,
599 pub zs: Vec<f64>,
600}
601
602#[derive(Clone, PartialEq, Debug)]
603pub struct CubeVoxelShape {
604 shape: DiscreteVoxelShape,
605 #[allow(dead_code)]
607 faces: Option<Vec<VoxelShape>>,
608
609 x_coords: Vec<f64>,
610 y_coords: Vec<f64>,
611 z_coords: Vec<f64>,
612}
613
614impl ArrayVoxelShape {
615 pub fn new(shape: DiscreteVoxelShape, xs: Vec<f64>, ys: Vec<f64>, zs: Vec<f64>) -> Self {
616 let x_size = shape.size(Axis::X) + 1;
617 let y_size = shape.size(Axis::Y) + 1;
618 let z_size = shape.size(Axis::Z) + 1;
619
620 debug_assert_eq!(x_size, xs.len() as u32);
622 debug_assert_eq!(y_size, ys.len() as u32);
623 debug_assert_eq!(z_size, zs.len() as u32);
624
625 Self {
626 faces: None,
627 shape,
628 xs,
629 ys,
630 zs,
631 }
632 }
633}
634
635impl ArrayVoxelShape {
636 fn shape(&self) -> &DiscreteVoxelShape {
637 &self.shape
638 }
639
640 #[inline]
641 fn get_coords(&self, axis: Axis) -> &[f64] {
642 axis.choose(&self.xs, &self.ys, &self.zs)
643 }
644}
645
646impl CubeVoxelShape {
647 pub fn new(shape: DiscreteVoxelShape) -> Self {
648 let x_coords = Self::calculate_coords(&shape, Axis::X);
649 let y_coords = Self::calculate_coords(&shape, Axis::Y);
650 let z_coords = Self::calculate_coords(&shape, Axis::Z);
651
652 Self {
653 shape,
654 faces: None,
655 x_coords,
656 y_coords,
657 z_coords,
658 }
659 }
660}
661
662impl CubeVoxelShape {
663 fn shape(&self) -> &DiscreteVoxelShape {
664 &self.shape
665 }
666
667 fn calculate_coords(shape: &DiscreteVoxelShape, axis: Axis) -> Vec<f64> {
668 let size = shape.size(axis);
669 let mut parts = Vec::with_capacity(size as usize);
670 for i in 0..=size {
671 parts.push(i as f64 / size as f64);
672 }
673 parts
674 }
675
676 #[inline]
677 fn get_coords(&self, axis: Axis) -> &[f64] {
678 axis.choose(&self.x_coords, &self.y_coords, &self.z_coords)
679 }
680
681 fn find_index(&self, axis: Axis, coord: f64) -> i32 {
682 let n = self.shape().size(axis);
683 f64::floor(f64::clamp(coord * (n as f64), -1f64, n as f64)) as i32
684 }
685}
686
687#[derive(Debug)]
688pub struct CubePointRange {
689 pub parts: NonZeroU32,
691}
692impl CubePointRange {
693 pub fn get_double(&self, index: u32) -> f64 {
694 index as f64 / self.parts.get() as f64
695 }
696
697 pub fn size(&self) -> u32 {
698 self.parts.get() + 1
699 }
700
701 pub fn iter(&self) -> Vec<f64> {
702 (0..=self.parts.get()).map(|i| self.get_double(i)).collect()
703 }
704}
705
706#[cfg(test)]
707mod tests {
708 use super::*;
709
710 #[test]
711 fn test_block_shape() {
712 let shape = &*BLOCK_SHAPE;
713 assert_eq!(shape.shape().size(Axis::X), 1);
714 assert_eq!(shape.shape().size(Axis::Y), 1);
715 assert_eq!(shape.shape().size(Axis::Z), 1);
716
717 assert_eq!(shape.get_coords(Axis::X).len(), 2);
718 assert_eq!(shape.get_coords(Axis::Y).len(), 2);
719 assert_eq!(shape.get_coords(Axis::Z).len(), 2);
720 }
721
722 #[test]
723 fn test_box_shape() {
724 let shape = box_shape(0., 0., 0., 1., 1., 1.);
725 assert_eq!(shape.shape().size(Axis::X), 1);
726 assert_eq!(shape.shape().size(Axis::Y), 1);
727 assert_eq!(shape.shape().size(Axis::Z), 1);
728
729 assert_eq!(shape.get_coords(Axis::X).len(), 2);
730 assert_eq!(shape.get_coords(Axis::Y).len(), 2);
731 assert_eq!(shape.get_coords(Axis::Z).len(), 2);
732 }
733
734 #[test]
735 fn test_top_slab_shape() {
736 let shape = box_shape(0., 0.5, 0., 1., 1., 1.);
737 assert_eq!(shape.shape().size(Axis::X), 1);
738 assert_eq!(shape.shape().size(Axis::Y), 2);
739 assert_eq!(shape.shape().size(Axis::Z), 1);
740
741 assert_eq!(shape.get_coords(Axis::X).len(), 2);
742 assert_eq!(shape.get_coords(Axis::Y).len(), 3);
743 assert_eq!(shape.get_coords(Axis::Z).len(), 2);
744 }
745
746 #[test]
747 fn test_join_is_not_empty() {
748 let shape = box_shape(0., 0., 0., 1., 1., 1.);
749 let shape2 = box_shape(0., 0.5, 0., 1., 1., 1.);
750 let joined = Shapes::matches_anywhere(&shape, &shape2, |a, b| a && b);
752 assert!(joined, "Shapes should intersect");
753 }
754
755 #[test]
756 fn clip_in_front_of_block() {
757 let block_shape = &*BLOCK_SHAPE;
758 let block_hit_result = block_shape
759 .clip(
760 Vec3::new(-0.3, 0.5, 0.),
761 Vec3::new(5.3, 0.5, 0.),
762 BlockPos::new(0, 0, 0),
763 )
764 .unwrap();
765
766 assert_eq!(
767 block_hit_result,
768 BlockHitResult {
769 location: Vec3 {
770 x: 0.0,
771 y: 0.5,
772 z: 0.0
773 },
774 direction: Direction::West,
775 block_pos: BlockPos { x: 0, y: 0, z: 0 },
776 inside: false,
777 world_border: false,
778 miss: false
779 }
780 );
781 }
782}