Class XSkull
Some websites to get custom heads:
Usage
The basic usage format of this API is as follows:
XSkull.createItem().profile(Profileable.of(player)).apply();
XSkull.of(item/block).profile(Profileable.of(configStringValue)).apply();
Note: Make sure to read ProfileInstruction.applyAsync() if you're going to
be requesting heads in the main thread.
This API replaces SkullMeta and Skull which doesn't properly handle skulls
in edge cases just like any other system that relies on the default Mojang handlers.
It also specifically supports offline servers too.
Mechanism
The basic premise behind this API is that the final skull data is contained in a GameProfile
either by ID, name or encoded textures URL property.
Different versions of Minecraft client handle this differently. In newer versions the client seem to prioritize the texture property over the set UUID and name, in older versions however using the same UUID for all GameProfiles caused all skulls (that use base64) to look the same. The client is responsible for caching skull textures. If the download were to fail (either because of connection issues or invalid values) the client will cache that skull UUID and the skull will remain as a steve head until the client is completely restarted. I don't know if this cache system works across other servers or is just specific to one server.
- Version:
- 11.2.0
- Author:
- Crypto Morin, Erick Alexander
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ProfileInstruction<org.bukkit.inventory.ItemStack> Creates aProfileInstructionfor anItemStack.protected static ProfileableRetrieves the defaultGameProfileused by XSkull.static ProfileInstruction<org.bukkit.block.Block> of(org.bukkit.block.Block block) Creates aProfileInstructionfor aBlock.static ProfileInstruction<org.bukkit.block.Skull> of(org.bukkit.block.BlockState state) Creates aProfileInstructionfor aBlockState.static ProfileInstruction<org.bukkit.inventory.ItemStack> of(org.bukkit.inventory.ItemStack stack) Creates aProfileInstructionfor anItemStack.static ProfileInstruction<org.bukkit.inventory.meta.ItemMeta> of(org.bukkit.inventory.meta.ItemMeta meta) Creates aProfileInstructionfor anItemMeta.
-
Constructor Details
-
XSkull
public XSkull()
-
-
Method Details
-
createItem
Creates aProfileInstructionfor anItemStack. This method initializes a new player head.- Returns:
- A
ProfileInstructionthat sets the profile for the generatedItemStack.
-
of
public static ProfileInstruction<org.bukkit.inventory.ItemStack> of(org.bukkit.inventory.ItemStack stack) Creates aProfileInstructionfor anItemStack.- Parameters:
stack- TheItemStackto set the profile for.- Returns:
- A
ProfileInstructionthat sets the profile for the givenItemStack.
-
of
public static ProfileInstruction<org.bukkit.inventory.meta.ItemMeta> of(org.bukkit.inventory.meta.ItemMeta meta) Creates aProfileInstructionfor anItemMeta.- Parameters:
meta- TheItemMetato set the profile for.- Returns:
- An
ProfileInstructionthat sets the profile for the givenItemMeta.
-
of
Creates aProfileInstructionfor aBlock.- Parameters:
block- TheBlockto set the profile for.- Returns:
- An
ProfileInstructionthat sets the profile for the givenBlock.
-
of
Creates aProfileInstructionfor aBlockState.- Parameters:
state- TheBlockStateto set the profile for.- Returns:
- An
ProfileInstructionthat sets the profile for the givenBlockState.
-
getDefaultProfile
Retrieves the defaultGameProfileused by XSkull. This method creates a clone of the default profile to prevent modifications to the original.- Returns:
- A clone of the default
GameProfile.
-