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>>) -> Self
pub fn is_block_passable(&self, pos: BlockPos) -> bool
pub fn is_block_solid(&self, pos: BlockPos) -> bool
Sourcepub fn cost_for_breaking_block(
&self,
pos: BlockPos,
mining_cache: &MiningCache,
) -> f32
pub fn cost_for_breaking_block( &self, pos: BlockPos, 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: BlockPos) -> bool
pub fn is_passable(&self, pos: BlockPos) -> bool
Whether this block and the block above are passable
pub fn cost_for_passing(&self, pos: BlockPos, mining_cache: &MiningCache) -> f32
Sourcepub fn is_standable(&self, pos: BlockPos) -> bool
pub fn is_standable(&self, pos: BlockPos) -> 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: BlockPos, mining_cache: &MiningCache, ) -> f32
Sourcepub fn fall_distance(&self, pos: BlockPos) -> u32
pub fn fall_distance(&self, pos: BlockPos) -> u32
Get the amount of air blocks until the next solid block below this one.
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> 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>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<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>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
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)
Convert
&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)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Forward to the method defined on the type
Any
.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Forward to the method defined on the type
Any
.