Interface PlayerHeadObjectContents
- All Superinterfaces:
ObjectContents
The contents of a player head.
This object closely mirrors the serialized form of the component contents. This means the game will use its standard heuristics to determine whether the profile needs resolving before display. As of 1.21.9, the profile will be resolved if the name or id is present without any properties.
- Since:
- 4.25.0
- Since Minecraft:
- 1.21.9
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA builder for aPlayerHeadObjectContents.static interfaceA player profile property value with an optional signature.static interfaceA source of player skin data. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanThe default value for whether the player's hat layer should render.static final StringThe regular expression for a valid player name. -
Method Summary
Modifier and TypeMethodDescriptionbooleanhat()Whether the player head should render the player's hat layer.@Nullable UUIDid()Gets the UUID of the player if present.static booleanisValidName(String name) Checks if the given name is a valid player name for a player head object.@Nullable Stringname()Gets the name of the player if present.@Unmodifiable List<PlayerHeadObjectContents.ProfileProperty> Gets the profile properties for the player.Creates a profile property with the given value and no signature.Creates a profile property with the given value and signature.@Nullable Keytexture()Optional namespaced ID of the skin texture to use for rendering.Creates a builder from the state of this object.
-
Field Details
-
DEFAULT_HAT
static final boolean DEFAULT_HATThe default value for whether the player's hat layer should render.- Since:
- 4.25.0
- See Also:
-
NAME_REGEX
The regular expression for a valid player name.This expression matches vanilla Minecraft's validation for what is considered a valid player name. It is a wider validation than what is allowed when currently creating a username.
- Since:
- 5.1.0
- See Also:
-
-
Method Details
-
isValidName
Checks if the given name is a valid player name for a player head object.- Parameters:
name- the name to validate- Returns:
- if the name is valid
- Since:
- 5.1.0
- See Also:
-
name
@Nullable String name()Gets the name of the player if present.- Returns:
- the name of the player or null
- Since:
- 4.25.0
-
id
@Nullable UUID id()Gets the UUID of the player if present.- Returns:
- the UUID of the player or null
- Since:
- 4.25.0
-
profileProperties
@Unmodifiable List<PlayerHeadObjectContents.ProfileProperty> profileProperties()Gets the profile properties for the player.- Returns:
- the properties
- Since:
- 4.25.0
-
hat
boolean hat()Whether the player head should render the player's hat layer.- Returns:
- whether to render the hat layer
- Since:
- 4.25.0
-
texture
@Nullable Key texture()Optional namespaced ID of the skin texture to use for rendering.The skin is specified relative to the textures folder and with a .png suffix e.g. entity/player/wide/steve will use the default wide Steve skin.
Overrides the skin specified by the profile properties if present.
- Returns:
- the texture key
- Since:
- 4.25.0
-
toBuilder
Creates a builder from the state of this object.- Returns:
- a new builder
- Since:
- 4.25.0
-
property
@Contract(value="_, _ -> new", pure=true) static PlayerHeadObjectContents.ProfileProperty property(String name, String value) Creates a profile property with the given value and no signature.- Parameters:
name- the namevalue- the value- Returns:
- a profile property
- Since:
- 4.25.0
-
property
@Contract(value="_, _, _ -> new", pure=true) static PlayerHeadObjectContents.ProfileProperty property(String name, String value, @Nullable String signature) Creates a profile property with the given value and signature.- Parameters:
name- the namevalue- the valuesignature- the signature, may be null- Returns:
- a profile property
- Since:
- 4.25.0
-