java.lang.Object
com.cryptomorin.xseries.profiles.builder.XSkull

public final class XSkull extends Object
A cross-version way to apply skin texture from different sources to items and blocks.

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.1
Author:
Crypto Morin, Erick Alexander
See Also:
  • Constructor Details

    • XSkull

      public XSkull()
  • Method Details

    • createItem

      @NotNull @Contract(value="-> new", pure=true) public static @NotNull ProfileInstruction<org.bukkit.inventory.ItemStack> createItem()
      Creates a ProfileInstruction for an ItemStack. This method initializes a new player head.
      Returns:
      A ProfileInstruction that sets the profile for the generated ItemStack.
    • of

      @NotNull @Contract(value="_ -> new", pure=true) public static @NotNull ProfileInstruction<org.bukkit.inventory.ItemStack> of(@NotNull @NotNull org.bukkit.inventory.ItemStack stack)
      Creates a ProfileInstruction for an ItemStack.
      Parameters:
      stack - The ItemStack to set the profile for.
      Returns:
      A ProfileInstruction that sets the profile for the given ItemStack.
    • of

      @NotNull @Contract(value="_ -> new", pure=true) public static @NotNull ProfileInstruction<org.bukkit.inventory.meta.ItemMeta> of(@NotNull @NotNull org.bukkit.inventory.meta.ItemMeta meta)
      Creates a ProfileInstruction for an ItemMeta.
      Parameters:
      meta - The ItemMeta to set the profile for.
      Returns:
      An ProfileInstruction that sets the profile for the given ItemMeta.
    • of

      @NotNull @Contract(value="_ -> new", pure=true) public static @NotNull ProfileInstruction<org.bukkit.block.Block> of(@NotNull @NotNull org.bukkit.block.Block block)
      Creates a ProfileInstruction for a Block.
      Parameters:
      block - The Block to set the profile for.
      Returns:
      An ProfileInstruction that sets the profile for the given Block.
    • of

      @NotNull @Contract(value="_ -> new", pure=true) public static @NotNull ProfileInstruction<org.bukkit.block.Skull> of(@NotNull @NotNull org.bukkit.block.BlockState state)
      Creates a ProfileInstruction for a BlockState.
      Parameters:
      state - The BlockState to set the profile for.
      Returns:
      An ProfileInstruction that sets the profile for the given BlockState.
    • getDefaultProfile

      @NotNull @Contract(value="-> new", pure=true) protected static @NotNull Profileable getDefaultProfile()
      Retrieves the default GameProfile used by XSkull. This method creates a clone of the default profile to prevent modifications to the original.
      Returns:
      A clone of the default GameProfile.