2019-06-29 22:01:28 -04:00
|
|
|
package com.minelittlepony.client;
|
|
|
|
|
|
|
|
import com.mojang.authlib.GameProfile;
|
|
|
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
|
|
|
import net.minecraft.client.MinecraftClient;
|
|
|
|
import net.minecraft.client.texture.PlayerSkinProvider;
|
|
|
|
import net.minecraft.util.Identifier;
|
|
|
|
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
|
|
|
public class SkinsProxy {
|
|
|
|
|
|
|
|
public static SkinsProxy instance = new SkinsProxy();
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
public Identifier getSkinTexture(GameProfile profile) {
|
|
|
|
PlayerSkinProvider skins = MinecraftClient.getInstance().getSkinProvider();
|
|
|
|
|
2019-07-16 09:20:40 +02:00
|
|
|
@Nullable
|
2019-06-29 22:01:28 -04:00
|
|
|
MinecraftProfileTexture texture = skins.getTextures(profile).get(MinecraftProfileTexture.Type.SKIN);
|
2019-07-16 09:20:40 +02:00
|
|
|
|
|
|
|
if (texture == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2019-07-03 22:06:00 -04:00
|
|
|
return skins.loadSkin(texture, MinecraftProfileTexture.Type.SKIN);
|
2019-06-29 22:01:28 -04:00
|
|
|
}
|
|
|
|
}
|