pub struct CraftingHandler {
crafting_container: Shared<CraftingContainer>,
result_container: Shared<ResultContainer>,
grid_size: usize,
}Expand description
A Recipe Handler for Crafting Recipes
Fields§
§crafting_container: Shared<CraftingContainer>§result_container: Shared<ResultContainer>§grid_size: usizeImplementations§
Source§impl CraftingHandler
impl CraftingHandler
Sourcepub const fn new(
crafting_container: Shared<CraftingContainer>,
result_container: Shared<ResultContainer>,
grid_size: usize,
) -> Self
pub const fn new( crafting_container: Shared<CraftingContainer>, result_container: Shared<ResultContainer>, grid_size: usize, ) -> Self
Creates a new Crafting Recipe Handler
Sourcepub fn crafting_id(&self) -> ContainerId
pub fn crafting_id(&self) -> ContainerId
The ContainerId of the crafting container
Sourcepub fn crafting_container(&self) -> Shared<CraftingContainer>
pub fn crafting_container(&self) -> Shared<CraftingContainer>
A shared handle to the crafting container.
Sourcepub fn result_id(&self) -> ContainerId
pub fn result_id(&self) -> ContainerId
The ContainerId of the result container
Trait Implementations§
Source§impl Clone for CraftingHandler
impl Clone for CraftingHandler
Source§fn clone(&self) -> CraftingHandler
fn clone(&self) -> CraftingHandler
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 CraftingHandler
impl ResultHandler for CraftingHandler
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 CraftingHandler
impl !UnwindSafe for CraftingHandler
impl Freeze for CraftingHandler
impl Send for CraftingHandler
impl Sync for CraftingHandler
impl Unpin for CraftingHandler
impl UnsafeUnpin for CraftingHandler
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<>>