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>
impl<R: FurnaceRecipe> Furnace<R>
Sourcepub fn build(tick: &Tick, recipe: R, iron: Bundle<Iron, 10>) -> Self
pub fn build(tick: &Tick, recipe: R, iron: Bundle<Iron, 10>) -> Self
Builds a furnace. Costs 10 iron.
Sourcepub fn change_recipe<R2: FurnaceRecipe>(
self,
recipe: R2,
) -> Result<Furnace<R2>, MachineNotEmptyError<Self>>
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.
Sourcepub fn inputs(&mut self, tick: &Tick) -> &mut <R as Recipe>::Inputs
pub fn inputs(&mut self, tick: &Tick) -> &mut <R as Recipe>::Inputs
Update internal state and access input buffers.
Sourcepub const fn input_amounts(&self) -> <R as Recipe>::InputAmountsType
pub const fn input_amounts(&self) -> <R as Recipe>::InputAmountsType
Amount of each input resource needed for one recipe cycle
Sourcepub fn outputs(&mut self, tick: &Tick) -> &mut <R as Recipe>::Outputs
pub fn outputs(&mut self, tick: &Tick) -> &mut <R as Recipe>::Outputs
Update internal state and access output buffers.
Sourcepub const fn output_amounts(&self) -> <R as Recipe>::OutputAmountsType
pub const fn output_amounts(&self) -> <R as Recipe>::OutputAmountsType
Amount of each output resource created per recipe cycle