Skip to main content

TooltipDisplay

Struct TooltipDisplay 

pub struct TooltipDisplay<'a> { /* private fields */ }
Expand description

The minecraft:tooltip_display component applied by ItemStack while it builds a hover tooltip.

Implementations§

§

impl<'a> TooltipDisplay<'a>

pub fn for_stack(stack: &'a ItemStack) -> TooltipDisplay<'a>

Read tooltip visibility from an owned API stack’s effective component patch. The game supplies this stack only after the tooltip subscription guard.

pub fn from_component( component: Option<&'a Tag>, ominous_banner: bool, ) -> TooltipDisplay<'a>

Borrow a tooltip component without copying it. ominous_banner represents the vanilla banner default when the engine stores that default implicitly.

pub fn name_visible(&self, creative: bool) -> bool

ItemStack.getTooltipLines: hide_tooltip suppresses the name unless the tooltip flag is creative.

pub fn shows(&self, component: &str) -> bool

TooltipDisplay.shows: whether details for a data component are shown.

Trait Implementations§

§

impl Put for TooltipDisplay<'_>

§

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

Writes it.

Auto Trait Implementations§

§

impl<'a> Freeze for TooltipDisplay<'a>

§

impl<'a> RefUnwindSafe for TooltipDisplay<'a>

§

impl<'a> Send for TooltipDisplay<'a>

§

impl<'a> Sync for TooltipDisplay<'a>

§

impl<'a> Unpin for TooltipDisplay<'a>

§

impl<'a> UnsafeUnpin for TooltipDisplay<'a>

§

impl<'a> UnwindSafe for TooltipDisplay<'a>

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.