pub enum RecipeDisplay {
CraftingShapeless(CraftingShapelessRecipeDisplay),
CraftingShaped(CraftingShapedRecipeDisplay),
Furnace(FurnaceRecipeDisplay),
Stonecutter(StonecutterRecipeDisplay),
Smithing(SmithingRecipeDisplay),
}Expand description
A recipe description sent for display by the client.
Each enum variant fixes both the ID in the minecraft:recipe_display
registry and its payload structure, so mismatched IDs and payloads cannot
be represented. The current protocol IDs are:
0:minecraft:crafting_shapeless1:minecraft:crafting_shaped2:minecraft:furnace3:minecraft:stonecutter4:minecraft:smithing
§Examples
use mcproto_types::{
CraftingShapedRecipeDisplay, RecipeDisplay, SlotDisplay, TypeCodec,
};
let display = RecipeDisplay::CraftingShaped(
CraftingShapedRecipeDisplay::new(
2,
1,
vec![SlotDisplay::Empty, SlotDisplay::AnyFuel],
SlotDisplay::Empty,
SlotDisplay::AnyFuel,
)?,
);
let mut encoded = Vec::new();
display.encode(&mut encoded)?;
let mut input = encoded.as_slice();
assert_eq!(RecipeDisplay::decode(&mut input)?, display);
assert!(input.is_empty());See the official Recipe Display structure documentation.
Variants§
CraftingShapeless(CraftingShapelessRecipeDisplay)
CraftingShaped(CraftingShapedRecipeDisplay)
Furnace(FurnaceRecipeDisplay)
Stonecutter(StonecutterRecipeDisplay)
Smithing(SmithingRecipeDisplay)
Trait Implementations§
Source§impl Clone for RecipeDisplay
impl Clone for RecipeDisplay
Source§fn clone(&self) -> RecipeDisplay
fn clone(&self) -> RecipeDisplay
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 Debug for RecipeDisplay
impl Debug for RecipeDisplay
Source§impl PartialEq for RecipeDisplay
impl PartialEq for RecipeDisplay
impl StructuralPartialEq for RecipeDisplay
Auto Trait Implementations§
impl Freeze for RecipeDisplay
impl RefUnwindSafe for RecipeDisplay
impl Send for RecipeDisplay
impl Sync for RecipeDisplay
impl Unpin for RecipeDisplay
impl UnsafeUnpin for RecipeDisplay
impl UnwindSafe for RecipeDisplay
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,
Source§impl<T> ContextualCodec for Twhere
T: TypeCodec,
impl<T> ContextualCodec for Twhere
T: TypeCodec,
Source§fn encode_with_context(
&self,
writer: &mut impl Write,
_context: &Context,
) -> Result<(), CodecError>
fn encode_with_context( &self, writer: &mut impl Write, _context: &Context, ) -> Result<(), CodecError>
Encodes this value using context supplied by its enclosing structure.
Source§fn decode_with_context(
reader: &mut impl Read,
_context: &Context,
) -> Result<T, CodecError>where
T: Sized,
fn decode_with_context(
reader: &mut impl Read,
_context: &Context,
) -> Result<T, CodecError>where
T: Sized,
Decodes this value using context supplied by its enclosing structure.