pub enum WorldCoord {
Double,
Float {
int_offset: i8,
term: f32,
},
}Expand description
How vanilla turns one bound of a collision box into an absolute world coordinate.
Most 1.8 blocks compute blockPos + localBound in double (WorldCoord::Double), which is
exact. A few (cactus, cake, fence gate, soul sand, snow layer) do the addition in float:
(float) (blockPos + int_offset) + term, widened to double. That rounds once
|blockPos| is large (from 2^20 ≈ 1M blocks for 1/16 steps), and the rounded value is what
vanilla collides with.
Variants§
Double
f64::from(pos) + local (the matching Aabb bound).
Float
f64::from((pos + int_offset) as f32 + term): Java i2f, fadd, f2d.
Implementations§
Trait Implementations§
Source§impl Clone for WorldCoord
impl Clone for WorldCoord
impl Copy for WorldCoord
Source§impl Debug for WorldCoord
impl Debug for WorldCoord
Source§impl PartialEq for WorldCoord
impl PartialEq for WorldCoord
impl StructuralPartialEq for WorldCoord
Auto Trait Implementations§
impl Forget for WorldCoord
impl Freeze for WorldCoord
impl RefUnwindSafe for WorldCoord
impl Send for WorldCoord
impl Sync for WorldCoord
impl Unpin for WorldCoord
impl UnsafeUnpin for WorldCoord
impl UnwindSafe for WorldCoord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more