pub struct Skull {
skull_type: SkullTypeRef,
data: SkullData,
}Expand description
Builder for skull items
Fields§
§skull_type: SkullTypeRef§data: SkullDataImplementations§
Source§impl Skull
impl Skull
Sourcepub fn new(skull_type: SkullTypeRef) -> Self
pub fn new(skull_type: SkullTypeRef) -> Self
Creates a new Skull from the given SkullTypeRef
See Skull::of for creating a player’s skull from their gameprofile
See Skull::player_named for creating a player’s skull from their name
See Skull::texture for creating a player skull from a texture base64 string
Sourcepub fn of(player: impl Into<ResolvableProfile>) -> Self
pub fn of(player: impl Into<ResolvableProfile>) -> Self
Creates a player head from the profile of a player
let skull = Skull::of(player.gameprofile.clone());Sourcepub fn player_named(name: impl Into<String>) -> Result<Self>
pub fn player_named(name: impl Into<String>) -> Result<Self>
Creates a player head that the client resolves by player name
let skull = Skull::player_named("Notch");Sourcepub fn texture(value: impl Into<String>) -> Result<Self>
pub fn texture(value: impl Into<String>) -> Result<Self>
Creates a player head showing a texture from a base64 encoded string
const TEXTURE: &str = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2M2OWQ0MTA3NmE4ZGVhNGYwNmQzZjFhOWFjNDdjYzk5Njk4OGI3NGEwOTEzYWIyYWMxYTc0Y2FmNzA4MTkxOCJ9fX0=";
let skull = Skull::texture(TEXTURE);Sourcepub fn custom_name(self, custom_name: impl Into<TextComponent>) -> Self
pub fn custom_name(self, custom_name: impl Into<TextComponent>) -> Self
Sets the custom name
Sourcepub fn note_block_sound(self, note_block_sound: Identifier) -> Self
pub fn note_block_sound(self, note_block_sound: Identifier) -> Self
Sets the custom note block sound
Sourcepub fn from_item(item: &ItemStack) -> Option<Self>
pub fn from_item(item: &ItemStack) -> Option<Self>
Reads the skull data from an ItemStack and returns the skull
Sourcepub fn from_world(world: &World, pos: BlockPos) -> Option<Self>
pub fn from_world(world: &World, pos: BlockPos) -> Option<Self>
Reads the skull placed at pos
Sourcepub fn block_state(
&self,
placement: SkullPlacement,
) -> Result<BlockStateId, InvalidPlacementError>
pub fn block_state( &self, placement: SkullPlacement, ) -> Result<BlockStateId, InvalidPlacementError>
Returns the block state of this skull for the given placement
Sourcepub fn place(
&self,
world: &Arc<World>,
pos: BlockPos,
placement: SkullPlacement,
update_flags: UpdateFlags,
) -> Result<(), InvalidPlacementError>
pub fn place( &self, world: &Arc<World>, pos: BlockPos, placement: SkullPlacement, update_flags: UpdateFlags, ) -> Result<(), InvalidPlacementError>
Places this skull as a block and block entity
must run in Steel’s serialized world-mutation phase
See World::set_block for the warning
Trait Implementations§
impl Eq for Skull
impl StructuralPartialEq for Skull
Auto Trait Implementations§
impl !RefUnwindSafe for Skull
impl !UnwindSafe for Skull
impl Freeze for Skull
impl Send for Skull
impl Sync for Skull
impl Unpin for Skull
impl UnsafeUnpin for Skull
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
self with key and returns true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreArc<SyncMutex<>>