pub struct CachedWorld { /* private fields */ }
Expand description
An efficient representation of the world used for the pathfinder.
Implementations§
Source§impl CachedWorld
impl CachedWorld
pub fn new(world_lock: Arc<RwLock<Instance>>, origin: BlockPos) -> Self
pub fn is_block_passable(&self, pos: RelBlockPos) -> bool
Sourcepub fn get_block_state(&self, pos: RelBlockPos) -> BlockState
pub fn get_block_state(&self, pos: RelBlockPos) -> BlockState
Get the block state at the given position. This is relatively slow, so you should avoid it whenever possible.
pub fn is_block_solid(&self, pos: RelBlockPos) -> bool
pub fn is_block_standable(&self, pos: RelBlockPos) -> bool
Sourcepub fn cost_for_breaking_block(
&self,
pos: RelBlockPos,
mining_cache: &MiningCache,
) -> f32
pub fn cost_for_breaking_block( &self, pos: RelBlockPos, mining_cache: &MiningCache, ) -> f32
Returns how much it costs to break this block. Returns 0 if the block is already passable.
Sourcepub fn is_passable(&self, pos: RelBlockPos) -> bool
pub fn is_passable(&self, pos: RelBlockPos) -> bool
Whether this block and the block above are passable
pub fn cost_for_passing( &self, pos: RelBlockPos, mining_cache: &MiningCache, ) -> f32
Sourcepub fn is_standable(&self, pos: RelBlockPos) -> bool
pub fn is_standable(&self, pos: RelBlockPos) -> bool
Whether we can stand in this position. Checks if the block below is solid, and that the two blocks above that are passable.
pub fn cost_for_standing( &self, pos: RelBlockPos, mining_cache: &MiningCache, ) -> f32
Sourcepub fn fall_distance(&self, pos: RelBlockPos) -> u32
pub fn fall_distance(&self, pos: RelBlockPos) -> u32
Get the amount of air blocks until the next solid block below this one.
pub fn origin(&self) -> BlockPos
Auto Trait Implementations§
impl !Freeze for CachedWorld
impl !RefUnwindSafe for CachedWorld
impl Send for CachedWorld
impl !Sync for CachedWorld
impl Unpin for CachedWorld
impl !UnwindSafe for CachedWorld
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
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.