pub struct GrindstoneResultHandler {
input_container: Shared<SimpleContainer>,
result_container: Shared<ResultContainer>,
block_pos: BlockPos,
world: Arc<World>,
}Expand description
Result slot handler for a grindstone.
Fields§
§input_container: Shared<SimpleContainer>§result_container: Shared<ResultContainer>§block_pos: BlockPos§world: Arc<World>Implementations§
Source§impl GrindstoneResultHandler
impl GrindstoneResultHandler
Sourcepub const fn new(
input_container: Shared<SimpleContainer>,
result_container: Shared<ResultContainer>,
block_pos: BlockPos,
world: Arc<World>,
) -> Self
pub const fn new( input_container: Shared<SimpleContainer>, result_container: Shared<ResultContainer>, block_pos: BlockPos, world: Arc<World>, ) -> Self
Creates a new handler.
Sourcefn get_experience_amount(&self, guard: &ContainerLockGuard) -> i32
fn get_experience_amount(&self, guard: &ContainerLockGuard) -> i32
Experience dropped when the result is taken: roughly half the enchanting cost of both inputs, randomized upward. Must be called before the inputs are cleared.
fn get_experience_from_item(item: &ItemStack) -> i32
Trait Implementations§
Source§impl Clone for GrindstoneResultHandler
impl Clone for GrindstoneResultHandler
Source§fn clone(&self) -> GrindstoneResultHandler
fn clone(&self) -> GrindstoneResultHandler
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 GrindstoneResultHandler
impl ResultHandler for GrindstoneResultHandler
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 GrindstoneResultHandler
impl !UnwindSafe for GrindstoneResultHandler
impl Freeze for GrindstoneResultHandler
impl Send for GrindstoneResultHandler
impl Sync for GrindstoneResultHandler
impl Unpin for GrindstoneResultHandler
impl UnsafeUnpin for GrindstoneResultHandler
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<>>