Class SkinProvider

java.lang.Object
org.geysermc.geyser.skin.SkinProvider

public class SkinProvider extends Object
  • Field Details

    • ALLOW_THIRD_PARTY_CAPES

      public static final boolean ALLOW_THIRD_PARTY_CAPES
    • STEVE_SKIN

      public static final byte[] STEVE_SKIN
    • EMPTY_SKIN

      public static final SkinProvider.Skin EMPTY_SKIN
    • ALEX_SKIN

      public static final byte[] ALEX_SKIN
    • EMPTY_SKIN_ALEX

      public static final SkinProvider.Skin EMPTY_SKIN_ALEX
    • EMPTY_CAPE

      public static final SkinProvider.Cape EMPTY_CAPE
    • ALLOW_THIRD_PARTY_EARS

      public static final boolean ALLOW_THIRD_PARTY_EARS
    • EARS_GEOMETRY

      public static final String EARS_GEOMETRY
    • EARS_GEOMETRY_SLIM

      public static final String EARS_GEOMETRY_SLIM
    • SKULL_GEOMETRY

      public static final SkinProvider.SkinGeometry SKULL_GEOMETRY
    • WEARING_CUSTOM_SKULL

      public static final SkinProvider.SkinGeometry WEARING_CUSTOM_SKULL
    • WEARING_CUSTOM_SKULL_SLIM

      public static final SkinProvider.SkinGeometry WEARING_CUSTOM_SKULL_SLIM
    • OBJECT_MAPPER

      public static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
  • Constructor Details

    • SkinProvider

      public SkinProvider()
  • Method Details

    • hasCapeCached

      public static boolean hasCapeCached(String capeUrl)
    • getCachedSkin

      public static SkinProvider.Skin getCachedSkin(String skinUrl)
    • getCachedCape

      public static SkinProvider.Cape getCachedCape(String capeUrl)
    • requestSkinData

      public static CompletableFuture<SkinProvider.SkinData> requestSkinData(PlayerEntity entity)
    • requestSkinAndCape

      public static CompletableFuture<SkinProvider.SkinAndCape> requestSkinAndCape(UUID playerId, String skinUrl, String capeUrl)
    • requestSkin

      public static CompletableFuture<SkinProvider.Skin> requestSkin(UUID playerId, String textureUrl, boolean newThread)
    • requestCape

      public static CompletableFuture<SkinProvider.Cape> requestCape(String capeUrl, SkinProvider.CapeProvider provider, boolean newThread)
    • requestUnofficialCape

      public static CompletableFuture<SkinProvider.Cape> requestUnofficialCape(SkinProvider.Cape officialCape, UUID playerId, String username, boolean newThread)
    • requestEars

      public static CompletableFuture<SkinProvider.Skin> requestEars(String earsUrl, boolean newThread, SkinProvider.Skin skin)
    • requestUnofficialEars

      public static CompletableFuture<SkinProvider.Skin> requestUnofficialEars(SkinProvider.Skin officialSkin, UUID playerId, String username, boolean newThread)
      Try and find an ear texture for a Java player
      Parameters:
      officialSkin - The current players skin
      playerId - The players UUID
      username - The players username
      newThread - Should we start in a new thread
      Returns:
      The updated skin with ears
    • requestBedrockCape

      public static CompletableFuture<SkinProvider.Cape> requestBedrockCape(UUID playerID)
    • requestBedrockGeometry

      public static CompletableFuture<SkinProvider.SkinGeometry> requestBedrockGeometry(SkinProvider.SkinGeometry currentGeometry, UUID playerID)
    • storeBedrockSkin

      public static void storeBedrockSkin(UUID playerID, String skinID, byte[] skinData)
    • storeBedrockCape

      public static void storeBedrockCape(UUID playerID, byte[] capeData)
    • storeBedrockGeometry

      public static void storeBedrockGeometry(UUID playerID, byte[] geometryName, byte[] geometryData)
    • storeEarSkin

      public static void storeEarSkin(SkinProvider.Skin skin)
      Stores the adjusted skin with the ear texture to the cache
      Parameters:
      skin - The skin to cache
    • storeEarGeometry

      public static void storeEarGeometry(UUID playerID, boolean isSlim)
      Stores the geometry for a Java player with ears
      Parameters:
      playerID - The UUID to cache it against
      isSlim - If the player is using an slim base
    • requestTexturesFromUsername

      public static CompletableFuture<com.github.steveice10.mc.auth.data.GameProfile> requestTexturesFromUsername(com.github.steveice10.opennbt.tag.builtin.CompoundTag skullOwner)
      If a skull has a username but no textures, request them.
      Parameters:
      skullOwner - the CompoundTag of the skull with no textures
      Returns:
      a completable GameProfile with textures included
    • scale

      public static BufferedImage scale(BufferedImage bufferedImage, int newWidth, int newHeight)
    • imageDataToBufferedImage

      public static BufferedImage imageDataToBufferedImage(byte[] imageData, int imageWidth, int imageHeight)
      Convert a byte[] to a BufferedImage
      Parameters:
      imageData - The byte[] to convert
      imageWidth - The width of the target image
      imageHeight - The height of the target image
      Returns:
      The converted BufferedImage
    • bufferedImageToImageData

      public static byte[] bufferedImageToImageData(BufferedImage image)
      Convert a BufferedImage to a byte[]
      Parameters:
      image - The BufferedImage to convert
      Returns:
      The converted byte[]
    • getOrDefault

      public static <T> T getOrDefault(CompletableFuture<T> future, T defaultValue, int timeoutInSeconds)