Package org.geysermc.geyser.skin
Class SkinProvider
java.lang.Object
org.geysermc.geyser.skin.SkinProvider
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
static class
static class
static class
static class
static class
-
Field Summary
Modifier and TypeFieldDescriptionstatic byte[]
static boolean
static boolean
static String
static String
static SkinProvider.Cape
static SkinProvider.Skin
static SkinProvider.Skin
static com.fasterxml.jackson.databind.ObjectMapper
static SkinProvider.SkinGeometry
static byte[]
static SkinProvider.SkinGeometry
static SkinProvider.SkinGeometry
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
Convert a BufferedImage to a byte[]static SkinProvider.Cape
getCachedCape(String capeUrl)
static SkinProvider.Skin
getCachedSkin(String skinUrl)
static <T> T
getOrDefault(CompletableFuture<T> future, T defaultValue, int timeoutInSeconds)
static boolean
hasCapeCached(String capeUrl)
static BufferedImage
imageDataToBufferedImage(byte[] imageData, int imageWidth, int imageHeight)
Convert a byte[] to a BufferedImagestatic CompletableFuture<SkinProvider.Cape>
requestBedrockCape(UUID playerID)
requestBedrockGeometry(SkinProvider.SkinGeometry currentGeometry, UUID playerID)
static CompletableFuture<SkinProvider.Cape>
requestCape(String capeUrl, SkinProvider.CapeProvider provider, boolean newThread)
static CompletableFuture<SkinProvider.Skin>
requestEars(String earsUrl, boolean newThread, SkinProvider.Skin skin)
static CompletableFuture<SkinProvider.Skin>
requestSkin(UUID playerId, String textureUrl, boolean newThread)
requestSkinAndCape(UUID playerId, String skinUrl, String capeUrl)
requestSkinData(PlayerEntity entity)
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.static CompletableFuture<SkinProvider.Cape>
requestUnofficialCape(SkinProvider.Cape officialCape, UUID playerId, String username, boolean newThread)
static CompletableFuture<SkinProvider.Skin>
requestUnofficialEars(SkinProvider.Skin officialSkin, UUID playerId, String username, boolean newThread)
Try and find an ear texture for a Java playerstatic BufferedImage
scale(BufferedImage bufferedImage, int newWidth, int newHeight)
static void
storeBedrockCape(UUID playerID, byte[] capeData)
static void
storeBedrockGeometry(UUID playerID, byte[] geometryName, byte[] geometryData)
static void
storeBedrockSkin(UUID playerID, String skinID, byte[] skinData)
static void
storeEarGeometry(UUID playerID, boolean isSlim)
Stores the geometry for a Java player with earsstatic void
storeEarSkin(SkinProvider.Skin skin)
Stores the adjusted skin with the ear texture to the cache
-
Field Details
-
ALLOW_THIRD_PARTY_CAPES
public static final boolean ALLOW_THIRD_PARTY_CAPES -
STEVE_SKIN
public static final byte[] STEVE_SKIN -
EMPTY_SKIN
-
ALEX_SKIN
public static final byte[] ALEX_SKIN -
EMPTY_SKIN_ALEX
-
EMPTY_CAPE
-
ALLOW_THIRD_PARTY_EARS
public static final boolean ALLOW_THIRD_PARTY_EARS -
EARS_GEOMETRY
-
EARS_GEOMETRY_SLIM
-
SKULL_GEOMETRY
-
WEARING_CUSTOM_SKULL
-
WEARING_CUSTOM_SKULL_SLIM
-
OBJECT_MAPPER
public static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
-
-
Constructor Details
-
SkinProvider
public SkinProvider()
-
-
Method Details
-
hasCapeCached
-
getCachedSkin
-
getCachedCape
-
requestSkinData
-
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 skinplayerId
- The players UUIDusername
- The players usernamenewThread
- Should we start in a new thread- Returns:
- The updated skin with ears
-
requestBedrockCape
-
requestBedrockGeometry
public static CompletableFuture<SkinProvider.SkinGeometry> requestBedrockGeometry(SkinProvider.SkinGeometry currentGeometry, UUID playerID) -
storeBedrockSkin
-
storeBedrockCape
-
storeBedrockGeometry
-
storeEarSkin
Stores the adjusted skin with the ear texture to the cache- Parameters:
skin
- The skin to cache
-
storeEarGeometry
Stores the geometry for a Java player with ears- Parameters:
playerID
- The UUID to cache it againstisSlim
- 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
-
imageDataToBufferedImage
public static BufferedImage imageDataToBufferedImage(byte[] imageData, int imageWidth, int imageHeight)Convert a byte[] to a BufferedImage- Parameters:
imageData
- The byte[] to convertimageWidth
- The width of the target imageimageHeight
- The height of the target image- Returns:
- The converted BufferedImage
-
bufferedImageToImageData
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)
-