pub struct AnvilResultHandler {
input_container: Shared<SimpleContainer>,
result_container: Shared<ResultContainer>,
repair_item_count: Arc<AtomicI32>,
level_cost: Arc<AtomicI32>,
only_renaming: Arc<AtomicBool>,
block_pos: BlockPos,
world: Arc<World>,
}Expand description
Result slot handler for an anvil.
Fields§
§input_container: Shared<SimpleContainer>§result_container: Shared<ResultContainer>§repair_item_count: Arc<AtomicI32>§level_cost: Arc<AtomicI32>§only_renaming: Arc<AtomicBool>§block_pos: BlockPos§world: Arc<World>Implementations§
Source§impl AnvilResultHandler
impl AnvilResultHandler
Sourcepub const fn new(
input_container: Shared<SimpleContainer>,
result_container: Shared<ResultContainer>,
repair_item_count: Arc<AtomicI32>,
level_cost: Arc<AtomicI32>,
only_renaming: Arc<AtomicBool>,
block_pos: BlockPos,
world: Arc<World>,
) -> Self
pub const fn new( input_container: Shared<SimpleContainer>, result_container: Shared<ResultContainer>, repair_item_count: Arc<AtomicI32>, level_cost: Arc<AtomicI32>, only_renaming: Arc<AtomicBool>, block_pos: BlockPos, world: Arc<World>, ) -> Self
Creates a new handler.
fn damage_anvil(&self, state: BlockStateId)
Trait Implementations§
Source§impl Clone for AnvilResultHandler
impl Clone for AnvilResultHandler
Source§fn clone(&self) -> AnvilResultHandler
fn clone(&self) -> AnvilResultHandler
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ResultHandler for AnvilResultHandler
impl ResultHandler for AnvilResultHandler
Source§fn result_container(&self) -> ContainerRef
fn result_container(&self) -> ContainerRef
The container the result is written to and read from. Read more
Source§fn dependencies(&self) -> Vec<ContainerRef>
fn dependencies(&self) -> Vec<ContainerRef>
Auxiliary containers accessed while validating or taking the result. Read more
Source§fn update_result(&self, _guard: &mut ContainerLockGuard)
fn update_result(&self, _guard: &mut ContainerLockGuard)
Recalculate the result based on current inputs.
Source§fn on_result_taken(
&self,
guard: &mut ContainerLockGuard,
player: &Player,
) -> Option<ItemStack>
fn on_result_taken( &self, guard: &mut ContainerLockGuard, player: &Player, ) -> Option<ItemStack>
Consume inputs when the result is taken. Return overflow remainders.
Source§fn is_result_valid(&self, _guard: &ContainerLockGuard, player: &Player) -> bool
fn is_result_valid(&self, _guard: &ContainerLockGuard, player: &Player) -> bool
Whether the stored result still matches the current inputs.
Auto Trait Implementations§
impl !RefUnwindSafe for AnvilResultHandler
impl !UnwindSafe for AnvilResultHandler
impl Freeze for AnvilResultHandler
impl Send for AnvilResultHandler
impl Sync for AnvilResultHandler
impl Unpin for AnvilResultHandler
impl UnsafeUnpin for AnvilResultHandler
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreWraps this value in an
Arc<SyncMutex<>>