Skip to main content

Furnace

Struct Furnace 

Source
pub struct Furnace<R: FurnaceRecipe>(/* private fields */);
Expand description

The furnace is used to smelt ores into base resources.

To use, first build the furnace using Furnace::build, providing the desired recipe and the required resources. Then, add inputs using inputs, for example furnace.inputs(&tick).0.add(bundle). The furnace will automatically process the inputs over time, which can be advanced using the Tick. Outputs can be extracted using outputs, for example furnace.outputs(&tick).0.bundle::<1>(). If you want to change the recipe, use change_recipe, but ensure the furnace is empty first.

See the implementors of the FurnaceRecipe trait for recipes that can be used in the furnace.

Implementations§

Source§

impl<R: FurnaceRecipe> Furnace<R>

Source

pub fn build(tick: &Tick, recipe: R, iron: Bundle<Iron, 10>) -> Self

Builds a furnace. Costs 10 iron.

Source

pub fn change_recipe<R2: FurnaceRecipe>( self, recipe: R2, ) -> Result<Furnace<R2>, MachineNotEmptyError<Self>>

Changes the Recipe of the furnace. Returns the original furnace if the the input and output buffers are not empty.

Source

pub fn inputs(&mut self, tick: &Tick) -> &mut <R as Recipe>::Inputs

Update internal state and access input buffers.

Source

pub const fn input_amounts(&self) -> <R as Recipe>::InputAmountsType

Amount of each input resource needed for one recipe cycle

Source

pub fn outputs(&mut self, tick: &Tick) -> &mut <R as Recipe>::Outputs

Update internal state and access output buffers.

Source

pub const fn output_amounts(&self) -> <R as Recipe>::OutputAmountsType

Amount of each output resource created per recipe cycle

Trait Implementations§

Source§

impl<R: Debug + FurnaceRecipe> Debug for Furnace<R>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R> Freeze for Furnace<R>
where <R as Recipe>::Inputs: Freeze, <R as Recipe>::Outputs: Freeze,

§

impl<R> RefUnwindSafe for Furnace<R>

§

impl<R> Send for Furnace<R>
where <R as Recipe>::Inputs: Send, <R as Recipe>::Outputs: Send,

§

impl<R> Sync for Furnace<R>
where <R as Recipe>::Inputs: Sync, <R as Recipe>::Outputs: Sync,

§

impl<R> Unpin for Furnace<R>
where <R as Recipe>::Inputs: Unpin, <R as Recipe>::Outputs: Unpin,

§

impl<R> UnwindSafe for Furnace<R>
where <R as Recipe>::Inputs: UnwindSafe, <R as Recipe>::Outputs: UnwindSafe,

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.

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, 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.