Skip to main content

TreeWritePreflight

Struct TreeWritePreflight 

Source
struct TreeWritePreflight<'a, L: LevelAccessor + ?Sized> {
    level: &'a mut L,
    writes: RefCell<FxHashMap<BlockPos, BlockStateId>>,
    failed: Cell<bool>,
}

Fields§

§level: &'a mut L§writes: RefCell<FxHashMap<BlockPos, BlockStateId>>§failed: Cell<bool>

Implementations§

Source§

impl<'a, L: LevelAccessor + ?Sized> TreeWritePreflight<'a, L>

Source

fn new(level: &'a mut L) -> Self

Source

const fn failed(&self) -> bool

Trait Implementations§

Source§

impl<L: LevelAccessor + ?Sized> LevelAccessor for TreeWritePreflight<'_, L>

Source§

fn can_write_to_chunk(&self, chunk_x: i32, chunk_z: i32) -> bool

Returns whether this surface accepts writes into the given chunk.
Source§

fn set_block_state( &self, pos: BlockPos, state: BlockStateId, _flags: UpdateFlags, ) -> bool

Sets a block state with vanilla update flags.
Source§

fn destroy_block(&self, pos: BlockPos, _drop_items: bool) -> bool

Destroys a block and optionally drops its resources.
Source§

fn requires_live_write_preflight(&self) -> bool

Returns whether multi-block placements must be dry-run before committing.
Source§

fn play_block_sound( &self, sound: SoundEventRef, pos: BlockPos, volume: f32, pitch: f32, exclude: Option<i32>, )

Plays a block sound when this level surface supports runtime side effects.
Source§

fn game_event( &self, event: GameEventRef, pos: BlockPos, context: &GameEventContext<'_>, )

Dispatches a game event when this level surface supports runtime listeners.
Source§

impl<L: LevelAccessor + ?Sized> LevelReader for TreeWritePreflight<'_, L>

Source§

fn height_at(&self, heightmap_type: HeightmapType, x: i32, z: i32) -> i32

Returns the vanilla heightmap value at a column.
Source§

fn get_block_state(&self, pos: BlockPos) -> BlockStateId

Gets the block state at a position.
Source§

fn get_block_entity(&self, pos: BlockPos) -> Option<SharedBlockEntity>

Gets the block entity at a position when this level surface supports it
Source§

fn is_face_sturdy_for( &self, state: BlockStateId, pos: BlockPos, direction: Direction, support_type: SupportType, ) -> bool

Mirrors vanilla BlockState.isFaceSturdy for a specific support type. Read more
Source§

fn raw_brightness(&self, pos: BlockPos, sky_darkening: u8) -> u8

Returns vanilla raw brightness at a position after sky darkening.
Source§

fn can_see_sky(&self, pos: BlockPos) -> bool

Returns vanilla BlockAndLightGetter.canSeeSky.
Source§

fn ambient_light(&self) -> f32

Returns this dimension’s vanilla ambient light factor.
Source§

fn min_y(&self) -> i32

Returns the minimum build height.
Source§

fn height(&self) -> i32

Returns the build height.
Source§

fn is_face_sturdy( &self, state: BlockStateId, pos: BlockPos, direction: Direction, ) -> bool

Mirrors vanilla BlockState.isFaceSturdy with full-face support.
Source§

fn max_y_exclusive(&self) -> i32

Returns the exclusive maximum build height.
Source§

fn is_outside_build_height(&self, y: i32) -> bool

Checks if a Y coordinate is outside build height.
Source§

fn max_local_raw_brightness(&self, pos: BlockPos, sky_darkening: u8) -> u8

Returns vanilla LevelReader.getMaxLocalRawBrightness.
Source§

fn light_level_dependent_magic_value(&self, pos: BlockPos) -> f32

Returns vanilla LevelReader.getLightLevelDependentMagicValue.
Source§

fn pathfinding_cost_from_light_levels(&self, pos: BlockPos) -> f32

Returns vanilla LevelReader.getPathfindingCostFromLightLevels.
Source§

impl<L: LevelAccessor + ?Sized> ScheduledTickAccess for TreeWritePreflight<'_, L>

Source§

fn fluid_tick_delay(&self, fluid: FluidRef) -> i32

Returns the fluid tick delay in this level.
Source§

fn schedule_block_tick_default( &self, _pos: BlockPos, _block: BlockRef, _delay: i32, ) -> bool

Schedules a block tick using vanilla’s default priority.
Source§

fn schedule_fluid_tick_default( &self, _pos: BlockPos, _fluid: FluidRef, _delay: i32, ) -> bool

Schedules a fluid tick using vanilla’s default priority.
Source§

fn has_scheduled_block_tick(&self, pos: BlockPos, block: BlockRef) -> bool

Returns whether a tick is already scheduled for the same (pos, block).
Source§

fn will_tick_block_this_tick(&self, pos: BlockPos, block: BlockRef) -> bool

Returns whether the same (pos, block) was selected for this tick and has not started.
Source§

fn will_tick_fluid_this_tick(&self, pos: BlockPos, fluid: FluidRef) -> bool

Returns whether the same (pos, fluid) was selected for this tick and has not started.

Auto Trait Implementations§

§

impl<'a, L> !Freeze for TreeWritePreflight<'a, L>

§

impl<'a, L> !RefUnwindSafe for TreeWritePreflight<'a, L>

§

impl<'a, L> !Sync for TreeWritePreflight<'a, L>

§

impl<'a, L> !UnwindSafe for TreeWritePreflight<'a, L>

§

impl<'a, L> Send for TreeWritePreflight<'a, L>
where L: Send + ?Sized,

§

impl<'a, L> Unpin for TreeWritePreflight<'a, L>
where L: ?Sized,

§

impl<'a, L> UnsafeUnpin for TreeWritePreflight<'a, L>
where L: ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoShared for T

Source§

fn into_shared(self) -> Arc<Mutex<RawMutex, Self>> ⓘ

Wraps this value in an Arc<SyncMutex<>>
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SignalGetter for T
where T: LevelReader,

Source§

fn is_redstone_conductor(&self, state: BlockStateId, pos: BlockPos) -> bool

Returns whether state conducts direct power at this level position.
Source§

fn get_direct_signal(&self, pos: BlockPos, direction: Direction) -> i32

Returns the direct signal emitted by the block at pos toward direction.
Source§

fn get_direct_signal_to(&self, pos: BlockPos) -> i32

Returns the strongest direct signal entering pos from its six neighbors.
Source§

fn get_control_input_signal( &self, pos: BlockPos, direction: Direction, only_diodes: bool, ) -> i32

Returns the side input used by vanilla diode blocks.
Source§

fn has_signal(&self, pos: BlockPos, direction: Direction) -> bool

Returns whether the block at pos supplies a signal toward direction.
Source§

fn get_signal(&self, pos: BlockPos, direction: Direction) -> i32

Returns the signal supplied by the block at pos toward direction.
Source§

fn get_best_own_or_neighbour_signal(&self, pos: BlockPos) -> i32

Returns the strongest signal at pos, including the block’s own source value.
Source§

fn has_neighbor_signal(&self, pos: BlockPos) -> bool

Returns whether any of the six neighbors supplies signal to pos.
Source§

fn get_best_neighbor_signal(&self, pos: BlockPos) -> i32

Returns the strongest signal supplied to pos by its six neighbors.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more