Skip to main content

DisplayRef

Struct DisplayRef 

pub struct DisplayRef(/* private fields */);
Expand description

A display entity of the open world (block_display, item_display or text_display), narrowed with host.display.

Implementations§

§

impl DisplayRef

pub fn kind(self, host: &dyn Host) -> Option<DisplayKind>

Side: server. Which Display subclass the entity is.

pub fn transformation(self, host: &dyn Host) -> Option<Transformation>

Side: server. Display.createTransformation: the transformation as shown.

pub fn billboard(self, host: &dyn Host) -> Option<Billboard>

Side: server. Display.getBillboardConstraints.

pub fn brightness(self, host: &dyn Host) -> Option<(u8, u8)>

Side: server. Display.getBrightnessOverride: block and sky light, 0 to 15 each, or None for no override.

pub fn view_range(self, host: &dyn Host) -> Option<f32>

Side: server. Display.getViewRange.

pub fn shadow_radius(self, host: &dyn Host) -> Option<f32>

Side: server. Display.getShadowRadius.

pub fn shadow_strength(self, host: &dyn Host) -> Option<f32>

Side: server. Display.getShadowStrength.

pub fn width(self, host: &dyn Host) -> Option<f32>

Side: server. Display.getWidth: the culling box’s width, 0 for none.

pub fn height(self, host: &dyn Host) -> Option<f32>

Side: server. Display.getHeight: the culling box’s height, 0 for none.

pub fn glow_color_override(self, host: &dyn Host) -> Option<i32>

Side: server. Display.getGlowColorOverride: an ARGB color, or -1 for none.

pub fn interpolation_duration(self, host: &dyn Host) -> Option<i32>

Side: server. Display.getTransformationInterpolationDuration, in ticks.

pub fn start_interpolation(self, host: &dyn Host) -> Option<i32>

Side: server. Display.getTransformationInterpolationDelay: ticks before an interpolation starts.

pub fn teleport_duration(self, host: &dyn Host) -> Option<i32>

Side: server. Display.getPosRotInterpolationDuration: ticks a move eases over, 0 to 59.

pub fn text(self, host: &dyn Host) -> Result<Option<Text>, TextFormError>

Side: server. TextDisplay.getText; None for another kind of display. Refuses text deeper than 512 component nodes before applying any changes.

pub fn line_width(self, host: &dyn Host) -> Option<i32>

Side: server. TextDisplay.getLineWidth.

pub fn background(self, host: &dyn Host) -> Option<i32>

Side: server. TextDisplay.getBackgroundColor: ARGB.

pub fn text_opacity(self, host: &dyn Host) -> Option<i8>

Side: server. TextDisplay.getTextOpacity: -1 is opaque, else 0 to 127 then -128 to -2.

pub fn text_shadow(self, host: &dyn Host) -> Option<bool>

Side: server. TextDisplay.FLAG_SHADOW.

pub fn see_through(self, host: &dyn Host) -> Option<bool>

Side: server. TextDisplay.FLAG_SEE_THROUGH.

pub fn default_background(self, host: &dyn Host) -> Option<bool>

Side: server. TextDisplay.FLAG_USE_DEFAULT_BACKGROUND.

pub fn alignment(self, host: &dyn Host) -> Option<TextAlignment>

Side: server. TextDisplay.getAlign, from the left and right flags.

pub fn block_state(self, host: &dyn Host) -> Option<BlockState>

Side: server. BlockDisplay.getBlockState; None for another kind of display.

pub fn item(self, host: &dyn Host) -> Option<ItemStack>

Side: server. ItemDisplay.getItemStack; None for another kind of display or an empty stack.

pub fn item_context(self, host: &dyn Host) -> Option<ItemDisplayContext>

Side: server. ItemDisplay.getItemTransform: how the item is displayed.

pub fn set_transformation( self, host: &mut dyn ServerHost, transformation: Transformation, ) -> bool

Side: server. Sets the transformation. False for a value that isn’t finite or a zero quaternion. Clients ease to it when the start delay is set (set_start_interpolation).

pub fn set_billboard( self, host: &mut dyn ServerHost, billboard: Billboard, ) -> bool

Side: server. Display.setBillboardConstraints.

pub fn set_brightness( self, host: &mut dyn ServerHost, brightness: Option<(u8, u8)>, ) -> bool

Side: server. Display.setBrightnessOverride; None clears the override. False for a light level above 15.

pub fn set_view_range(self, host: &mut dyn ServerHost, range: f32) -> bool

Side: server. Display.setViewRange. False for a value that isn’t finite.

pub fn set_shadow_radius(self, host: &mut dyn ServerHost, radius: f32) -> bool

Side: server. Display.setShadowRadius. False for a value that isn’t finite.

pub fn set_shadow_strength( self, host: &mut dyn ServerHost, strength: f32, ) -> bool

Side: server. Display.setShadowStrength. False for a value that isn’t finite.

pub fn set_width(self, host: &mut dyn ServerHost, width: f32) -> bool

Side: server. Display.setWidth. False for a value that isn’t finite.

pub fn set_height(self, host: &mut dyn ServerHost, height: f32) -> bool

Side: server. Display.setHeight. False for a value that isn’t finite.

pub fn set_glow_color_override( self, host: &mut dyn ServerHost, color: i32, ) -> bool

Side: server. Display.setGlowColorOverride.

pub fn set_interpolation_duration( self, host: &mut dyn ServerHost, ticks: i32, ) -> bool

Side: server. Display.setTransformationInterpolationDuration.

pub fn set_start_interpolation( self, host: &mut dyn ServerHost, ticks: i32, ) -> bool

Side: server. Display.setTransformationInterpolationDelay. Like vanilla, every call is sent to the clients that track the display, even with the delay it already has, and each client restarts its interpolation.

pub fn set_teleport_duration( self, host: &mut dyn ServerHost, ticks: i32, ) -> bool

Side: server. Display.setPosRotInterpolationDuration, kept from 0 to 59 as vanilla’s load keeps it.

pub fn set_text( self, host: &mut dyn ServerHost, text: Text, ) -> Result<bool, TextFormError>

Side: server. TextDisplay.setText; false for another kind of display. Refuses text deeper than 512 component nodes before applying any changes.

pub fn set_line_width(self, host: &mut dyn ServerHost, width: i32) -> bool

Side: server. TextDisplay.setLineWidth; false for another kind of display.

pub fn set_background(self, host: &mut dyn ServerHost, argb: i32) -> bool

Side: server. TextDisplay.setBackgroundColor; false for another kind of display.

pub fn set_text_opacity(self, host: &mut dyn ServerHost, opacity: i8) -> bool

Side: server. TextDisplay.setTextOpacity; false for another kind of display.

pub fn set_text_shadow(self, host: &mut dyn ServerHost, on: bool) -> bool

Side: server. Sets the shadow flag; false for another kind of display.

pub fn set_see_through(self, host: &mut dyn ServerHost, on: bool) -> bool

Side: server. Sets the see-through flag; false for another kind of display.

pub fn set_default_background(self, host: &mut dyn ServerHost, on: bool) -> bool

Side: server. Sets the default-background flag; false for another kind of display.

pub fn set_alignment( self, host: &mut dyn ServerHost, alignment: TextAlignment, ) -> bool

Side: server. Sets the alignment; false for another kind of display.

pub fn set_block_state( self, host: &mut dyn ServerHost, state: BlockState, ) -> bool

Side: server. BlockDisplay.setBlockState; false for another kind of display or an unknown state.

pub fn set_item( self, host: &mut dyn ServerHost, stack: Option<ItemStack>, ) -> Result<bool, StackWriteError>

Side: server. ItemDisplay.setItemStack; None empties it. False for another kind of display.

pub fn set_item_context( self, host: &mut dyn ServerHost, context: ItemDisplayContext, ) -> bool

Side: server. ItemDisplay.setItemTransform; false for another kind of display.

§

impl DisplayRef

pub fn entity(self) -> EntityRef

The same entity as an EntityRef.

Trait Implementations§

§

impl Clone for DisplayRef

§

fn clone(&self) -> DisplayRef

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Copy for DisplayRef

§

impl Debug for DisplayRef

§

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

Formats the value using the given formatter. Read more
§

impl Eq for DisplayRef

§

impl Hash for DisplayRef

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl PartialEq for DisplayRef

§

fn eq(&self, other: &DisplayRef) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

impl StructuralPartialEq for DisplayRef

§

impl Wire for DisplayRef

§

const MIN: usize

Minimum encoded size, used to reject impossible collection lengths.
§

fn put(&self, out: &mut Writer)

Encodes this value, recording failures on the writer.
§

fn put_owned(self, out: &mut Writer)

Consumes owned data when a resource’s ownership must cross the boundary.
§

fn take(input: &mut Reader<'_>) -> Result<DisplayRef, WireError>

Decodes one value, leaving any following bytes for the caller.

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.

§

impl<T> Put for T
where T: Wire,

§

fn put_to(&self, out: &mut Writer)

Writes it.
§

impl<T> Record for T
where T: Wire,

§

fn encode(&self, out: &mut Writer)

Writes the argument into a hook call.
§

fn apply(&mut self, bytes: &[u8]) -> Result<(), WireError>

Applies one complete reply, refusing malformed or trailing bytes atomically.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.