pub enum BookPage {
Text {
text: String,
title: Option<String>,
font: Option<String>,
font_size: Option<f32>,
},
Spotlight {
item: String,
title: Option<String>,
text: Option<String>,
},
Recipe {
recipe: String,
text: Option<String>,
},
Image {
texture: String,
title: Option<String>,
text: Option<String>,
},
Entity {
entity: String,
name: Option<String>,
text: Option<String>,
},
Multiblock {
name: Option<String>,
pattern: Vec<Vec<String>>,
mapping: BTreeMap<String, String>,
text: Option<String>,
},
Relations {
entries: Vec<String>,
text: Option<String>,
},
Drawn {
drawer: String,
title: Option<String>,
height: f32,
caption: Option<String>,
text: Option<String>,
data: Value,
},
Empty,
Custom(CustomPage),
}Expand description
One page of an entry: {"type": "spotlight", "item": "@item:minecraft:stick", …}.
Variants§
Text
Text (Yog text: {b|…}, {#rrggbb|…}, {link=…|…}), with an
optional title; in another font (a resource-pack font id, e.g. a
ttf provider) at font_size pixels a line.
Fields
Spotlight
An item in a frame, its name (or title) and text.
Recipe
A recipe as its station shows it (a crafting grid, a furnace, …).
Image
An image (a Yog image source: a texture, .svg too).
Fields
Entity
A living entity, turning slowly.
Multiblock
A structure in 3D, turning: pattern is its layers top to bottom,
each a list of rows; each character stands for the block mapping
gives it (a block state: minecraft:furnace[facing=north]), for air.
Fields
Relations
Links to other entries.
Drawn
A picture the mod’s code draws (Registry::on_book_page) — Hex
Casting’s patterns, a mod’s diagram: the drawer registered under
that id gets data and a box the page’s width and height high,
between the title and a caption line, over the text.
Fields
Empty
Nothing (to start the next on a new spread).
Custom(CustomPage)
A page of a mod’s own type (type: "hexcasting:pattern"), laid out
by the book’s page_type::PageType of it.
Trait Implementations§
Source§impl Schema for BookPage
impl Schema for BookPage
Source§fn read(v: &ValueRef<'_>, cx: &mut Reader<'_>) -> Option<BookPage>
fn read(v: &ValueRef<'_>, cx: &mut Reader<'_>) -> Option<BookPage>
v. Problems go to cx at its current path; None when the
value couldn’t be read (the problem is in cx).Source§fn absent() -> Option<Self>
fn absent() -> Option<Self>
None: the field is required.Source§fn encode(&self, w: &mut Writer)
fn encode(&self, w: &mut Writer)
Schema::write’s
value encoded, unless the type knows better (derived ones do).Source§fn decode(d: &mut Decoder<'_>) -> Option<Self>
fn decode(d: &mut Decoder<'_>) -> Option<Self>
None when it isn’t
what Schema::encode writes — then read_bytes reads the slow
way, which says what’s wrong. Through a value unless the type knows
better (derived ones do).Source§fn pack(&self, p: &mut Packer)
fn pack(&self, p: &mut Packer)
crate::frame): its binary form as
bytes, unless the type packs itself (derived ones and plain types do).Source§fn unpack(u: &mut Unpacker<'_>) -> Option<Self>
fn unpack(u: &mut Unpacker<'_>) -> Option<Self>
None if the bytes aren’t what
Schema::pack writes.Source§fn pack_list(items: &[Self], p: &mut Packer)
fn pack_list(items: &[Self], p: &mut Packer)
Source§fn encode_list(items: &[Self], w: &mut Writer)
fn encode_list(items: &[Self], w: &mut Writer)
Auto Trait Implementations§
impl Freeze for BookPage
impl RefUnwindSafe for BookPage
impl Send for BookPage
impl Sync for BookPage
impl Unpin for BookPage
impl UnsafeUnpin for BookPage
impl UnwindSafe for BookPage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Message for Twhere
T: Schema,
impl<T> Message for Twhere
T: Schema,
Source§fn from_bytes(bytes: &[u8]) -> Option<Self>
fn from_bytes(bytes: &[u8]) -> Option<Self>
None if it isn’t one.Source§fn with_bytes<R>(&self, f: impl FnOnce(&[u8]) -> R) -> R
fn with_bytes<R>(&self, f: impl FnOnce(&[u8]) -> R) -> R
f on the payload, packed in this thread’s reused buffers: nothing
allocated once they’ve grown to the thread’s messages.