Package org.geysermc.geyser.skin
Class SkinProvider
java.lang.Object
org.geysermc.geyser.skin.SkinProvider
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic byte[]static booleanstatic booleanstatic Stringstatic Stringstatic SkinProvider.Capestatic SkinProvider.Skinstatic SkinProvider.Skinstatic com.fasterxml.jackson.databind.ObjectMapperstatic SkinProvider.SkinGeometrystatic byte[]static SkinProvider.SkinGeometrystatic SkinProvider.SkinGeometry -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]Convert a BufferedImage to a byte[]static SkinProvider.CapegetCachedCape(String capeUrl)static SkinProvider.SkingetCachedSkin(String skinUrl)static <T> TgetOrDefault(CompletableFuture<T> future, T defaultValue, int timeoutInSeconds)static booleanhasCapeCached(String capeUrl)static BufferedImageimageDataToBufferedImage(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 BufferedImagescale(BufferedImage bufferedImage, int newWidth, int newHeight)static voidstoreBedrockCape(UUID playerID, byte[] capeData)static voidstoreBedrockGeometry(UUID playerID, byte[] geometryName, byte[] geometryData)static voidstoreBedrockSkin(UUID playerID, String skinID, byte[] skinData)static voidstoreEarGeometry(UUID playerID, boolean isSlim)Stores the geometry for a Java player with earsstatic voidstoreEarSkin(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)
-