本文整理汇总了Java中com.mojang.authlib.minecraft.MinecraftProfileTexture类的典型用法代码示例。如果您正苦于以下问题:Java MinecraftProfileTexture类的具体用法?Java MinecraftProfileTexture怎么用?Java MinecraftProfileTexture使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MinecraftProfileTexture类属于com.mojang.authlib.minecraft包,在下文中一共展示了MinecraftProfileTexture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSkinResourceLocation
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public ResourceLocation getSkinResourceLocation() {
if (owner != null) {
final SkinManager manager = Minecraft.getMinecraft().getSkinManager();
Map<Type, MinecraftProfileTexture> map = manager.loadSkinFromCache(owner);
if (map.containsKey(Type.SKIN)) {
final MinecraftProfileTexture skin = map.get(Type.SKIN);
return manager.loadSkin(skin, Type.SKIN);
} else {
UUID uuid = EntityPlayer.getUUID(owner);
return DefaultPlayerSkin.getDefaultSkin(uuid);
}
}
return null;
}
示例2: onRenderPlayer
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入依赖的package包/类
@SubscribeEvent
public static void onRenderPlayer(RenderPlayerEvent.Post event)
{
EntityPlayer player = event.getEntityPlayer();
String uuid = player.getUUID(player.getGameProfile()).toString();
if(player instanceof AbstractClientPlayer && UUIDS.contains(uuid) && !done.contains(player))
{
AbstractClientPlayer clplayer = (AbstractClientPlayer) player;
if(clplayer.hasPlayerInfo())
{
NetworkPlayerInfo info = ReflectionHelper.getPrivateValue(AbstractClientPlayer.class, clplayer, ObfuscatedNames.PLAYER_INFO);
Map<MinecraftProfileTexture.Type, ResourceLocation> textures = ReflectionHelper.getPrivateValue(NetworkPlayerInfo.class, info, ObfuscatedNames.PLAYER_TEXTURES);
ResourceLocation loc = new ResourceLocation("proxyslib", "textures/whoknows/special_cape.png");
textures.put(MinecraftProfileTexture.Type.CAPE, loc);
textures.put(MinecraftProfileTexture.Type.ELYTRA, loc);
done.add(player);
}
}
}
示例3: onRenderPlayer
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入依赖的package包/类
@SubscribeEvent
public static void onRenderPlayer(RenderPlayerEvent.Post event)
{
EntityPlayer player = event.getEntityPlayer();
String uuid = player.getUUID(player.getGameProfile()).toString();
if(player instanceof AbstractClientPlayer && UUIDS.contains(uuid) && !done.contains(player))
{
AbstractClientPlayer clplayer = (AbstractClientPlayer) player;
if(clplayer.hasPlayerInfo())
{
NetworkPlayerInfo info = ReflectionHelper.getPrivateValue(AbstractClientPlayer.class, clplayer, ObfuscatedNames.PLAYER_INFO);
Map<MinecraftProfileTexture.Type, ResourceLocation> textures = ReflectionHelper.getPrivateValue(NetworkPlayerInfo.class, info, ObfuscatedNames.PLAYER_TEXTURES);
ResourceLocation loc = new ResourceLocation("proxyslib", "textures/whoknows/dev_cape.png");
textures.put(MinecraftProfileTexture.Type.CAPE, loc);
textures.put(MinecraftProfileTexture.Type.ELYTRA, loc);
done.add(player);
}
}
}
示例4: SkinManager
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入依赖的package包/类
public SkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService)
{
this.textureManager = textureManagerInstance;
this.skinCacheDir = skinCacheDirectory;
this.sessionService = sessionService;
this.skinCacheLoader = CacheBuilder.newBuilder().expireAfterAccess(15L, TimeUnit.SECONDS).<GameProfile, Map<Type, MinecraftProfileTexture>>build(new CacheLoader<GameProfile, Map<Type, MinecraftProfileTexture>>()
{
public Map<Type, MinecraftProfileTexture> load(GameProfile p_load_1_) throws Exception
{
try
{
return Minecraft.getMinecraft().getSessionService().getTextures(p_load_1_, false);
}
catch (Throwable var3)
{
return Maps.<Type, MinecraftProfileTexture>newHashMap();
}
}
});
}
示例5: PlayerSkin
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入依赖的package包/类
public PlayerSkin(UUID uuid){
profile = new GameProfile(uuid, ProfileUtil.getUsername(uuid));
PropertyMap properties = ProfileUtil.getProperties(uuid);
if(properties !=null){
Property textureProperty = Iterables.getFirst(properties.get("textures"), null);
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = null;
MinecraftTexturesPayload result;
try {
String json = new String(Base64.decodeBase64(textureProperty.getValue()), Charsets.UTF_8);
result = gson.fromJson(json, MinecraftTexturesPayload.class);
map = result.getTextures();
} catch (JsonParseException e) {
ModLogger.error("Could not decode textures payload", e);
map = new HashMap<MinecraftProfileTexture.Type, MinecraftProfileTexture>();
}
for(Type type : map.keySet()){
Minecraft.getMinecraft().getSkinManager().loadSkin(map.get(type), type, this);
}
}
//playerTextures = downloadPlayerTextures(profile);
}
示例6: skinAvailable
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入依赖的package包/类
@Override
public void skinAvailable(Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture)
{
//ModLogger.info("Skin Available "+typeIn+" "+location);
switch (typeIn)
{
case SKIN:
this.playerTextures.put(Type.SKIN, location);
this.skinType = profileTexture.getMetadata("model");
if (this.skinType == null)
{
this.skinType = "default";
}
break;
case CAPE:
this.playerTextures.put(Type.CAPE, location);
break;
case ELYTRA:
this.playerTextures.put(Type.ELYTRA, location);
}
}
示例7: getLocationSkin
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入依赖的package包/类
/**
* Get this player's skin
*/
@Override
public ResourceLocation getLocationSkin()
{
ResourceLocation resourcelocation = DefaultPlayerSkin.getDefaultSkinLegacy();
if (profile != null)
{
Minecraft minecraft = Minecraft.getMinecraft();
Map<Type, MinecraftProfileTexture> map = minecraft.getSkinManager().loadSkinFromCache(profile);
if (map.containsKey(Type.SKIN))
{
resourcelocation = minecraft.getSkinManager().loadSkin((MinecraftProfileTexture) map.get(Type.SKIN), Type.SKIN);
}
else
{
UUID uuid = EntityPlayer.getUUID(profile);
resourcelocation = DefaultPlayerSkin.getDefaultSkin(uuid);
}
}
return resourcelocation;
}
示例8: getLocationCape
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入依赖的package包/类
/**
* Get this player's custom cape skin
*/
public ResourceLocation getLocationCape()
{
ResourceLocation resourcelocation = null;
if (profile != null)
{
Minecraft minecraft = Minecraft.getMinecraft();
Map<Type, MinecraftProfileTexture> map = minecraft.getSkinManager().loadSkinFromCache(profile);
if (map.containsKey(Type.CAPE))
{
resourcelocation = minecraft.getSkinManager().loadSkin((MinecraftProfileTexture) map.get(Type.CAPE), Type.CAPE);
}
}
return resourcelocation;
}
示例9: getSkinType
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入依赖的package包/类
@Inject(
method = "getSkinType",
cancellable = true,
at = @At("RETURN"))
private void getSkinType(CallbackInfoReturnable<String> ci) {
MinecraftProfileTexture skin = HDSkinManager.INSTANCE.getProfileData(getGameProfile()).get(Type.SKIN);
if (skin != null) {
String type = skin.getMetadata("model");
if (type == null)
type = "default";
String type1 = type;
Optional<ResourceLocation> texture = HDSkinManager.INSTANCE.getSkinLocation(getGameProfile(), Type.SKIN, false);
texture.ifPresent((res) -> ci.setReturnValue(type1));
}
}
示例10: getPlayerTexture
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入依赖的package包/类
public static ResourceLocation getPlayerTexture(GameProfile playerProfile) {
ResourceLocation texture = Resources.STEVE;
if (playerProfile != null) {
if (playersTextureMap.containsKey(playerProfile)) {
texture = playersTextureMap.get(playerProfile);
} else {
Minecraft minecraft = Minecraft.getMinecraft();
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = minecraft.getSkinManager().loadSkinFromCache(playerProfile);
if (map.containsKey(MinecraftProfileTexture.Type.SKIN)) {
texture = minecraft.getSkinManager().loadSkin(map.get(MinecraftProfileTexture.Type.SKIN), MinecraftProfileTexture.Type.SKIN);
playersTextureMap.put(playerProfile, texture);
} else {
minecraft.getSkinManager().loadProfileTextures(playerProfile, (type, texture1, profileTexture) -> playersTextureMap.put(playerProfile, texture1), true);
}
}
}
return texture;
}
示例11: fixSkins
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入依赖的package包/类
/**
* Cycles through each player, downloads their skin, and assigns it to the location
* in their profile. The downloading is performed asynchronously, but can still
* cause lag due to the creation & reading of files.
* <br><br>
* Called every render tick because the image has to download, and because Minecraft
* resets the location of the skin every tick.
*/
public static void fixSkins() {
// Cycle through every player on the server.
for (EntityPlayer player : ServerHelper.getPlayersFromWorld()) {
AbstractClientPlayer absP = (AbstractClientPlayer)player;
// Safeguard because players are sometimes null...
if (player == null || absP.getLocationSkin() != absP.locationStevePng) continue;
// The name of the player without colors.
String name = Format.name(player.getDisplayName());
// The URL to download from.
String url = "http://skins.minecraft.net/MinecraftSkins/" + name + ".png";
// Store it as "username.skin"
ResourceLocation skin = CustomTextureAsync.get(name + ".skin", url, STEVE_SKIN);
// Assign the location of the skin.
absP.func_152121_a(MinecraftProfileTexture.Type.SKIN, skin);
}
}
示例12: loadPlayerTextures
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入依赖的package包/类
protected void loadPlayerTextures()
{
synchronized (this)
{
if (!this.playerTexturesLoaded)
{
this.playerTexturesLoaded = true;
Minecraft.getMinecraft().getSkinManager().loadProfileTextures(this.gameProfile, new SkinManager.SkinAvailableCallback()
{
public void skinAvailable(Type p_180521_1_, ResourceLocation location, MinecraftProfileTexture profileTexture)
{
switch (p_180521_1_)
{
case SKIN:
NetworkPlayerInfo.this.locationSkin = location;
NetworkPlayerInfo.this.skinType = profileTexture.getMetadata("model");
if (NetworkPlayerInfo.this.skinType == null)
{
NetworkPlayerInfo.this.skinType = "default";
}
break;
case CAPE:
NetworkPlayerInfo.this.locationCape = location;
}
}
}, true);
}
}
}
示例13: SkinManager
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入依赖的package包/类
public SkinManager(TextureManager textureManagerInstance, File skinCacheDirectory, MinecraftSessionService sessionService)
{
this.textureManager = textureManagerInstance;
this.skinCacheDir = skinCacheDirectory;
this.sessionService = sessionService;
this.skinCacheLoader = CacheBuilder.newBuilder().expireAfterAccess(15L, TimeUnit.SECONDS).<GameProfile, Map<Type, MinecraftProfileTexture>>build(new CacheLoader<GameProfile, Map<Type, MinecraftProfileTexture>>()
{
public Map<Type, MinecraftProfileTexture> load(GameProfile p_load_1_) throws Exception
{
return Minecraft.getMinecraft().getSessionService().getTextures(p_load_1_, false);
}
});
}
示例14: func_152789_a
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入依赖的package包/类
@Override
public ResourceLocation func_152789_a(final MinecraftProfileTexture texture, final Type type, final SkinManager.SkinAvailableCallback callBack) {
if (type != Type.SKIN)
return super.func_152789_a(texture, type, callBack);
final boolean isSpecialCallBack = callBack instanceof ISkinDownloadCallback;
final ResourceLocation resLocationOld = new ResourceLocation("skins/" + texture.getHash());
final ResourceLocation resLocation = new ResourceLocation(Reference.MOD_ID, resLocationOld.getResourcePath());
ITextureObject itextureobject = textureManager.getTexture(resLocation);
if (itextureobject != null) {
if (callBack != null)
callBack.func_152121_a(type, resLocation);
} else {
File file1 = new File(skinFolder, texture.getHash().substring(0, 2));
File file2 = new File(file1, texture.getHash());
final NewImageBufferDownload imgDownload = new NewImageBufferDownload();
ITextureObject imgData = new NewThreadDownloadImageData(file2, texture.getUrl(), field_152793_a, imgDownload, resLocationOld, new IImageBuffer() {
@Override
public BufferedImage parseUserSkin(BufferedImage buffImg) {
if (buffImg != null)
PlayerModelManager.analyseTexture(buffImg, resLocation);
return imgDownload.parseUserSkin(buffImg);
}
@Override
public void func_152634_a() {
imgDownload.func_152634_a();
if (callBack != null)
callBack.func_152121_a(type, isSpecialCallBack ? resLocation : resLocationOld);
}
});
textureManager.loadTexture(resLocation, imgData);
textureManager.loadTexture(resLocationOld, imgData); // Avoid thrown exception if the image is requested before the download is done
}
return isSpecialCallBack ? resLocation : resLocationOld;
}
示例15: loadPlayerTextures
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入依赖的package包/类
protected void loadPlayerTextures()
{
synchronized (this)
{
if (!this.playerTexturesLoaded)
{
this.playerTexturesLoaded = true;
Minecraft.getMinecraft().getSkinManager().loadProfileTextures(this.gameProfile, new SkinManager.SkinAvailableCallback()
{
public void skinAvailable(Type typeIn, ResourceLocation location, MinecraftProfileTexture profileTexture)
{
switch (typeIn)
{
case SKIN:
NetworkPlayerInfo.this.playerTextures.put(Type.SKIN, location);
NetworkPlayerInfo.this.skinType = profileTexture.getMetadata("model");
if (NetworkPlayerInfo.this.skinType == null)
{
NetworkPlayerInfo.this.skinType = "default";
}
break;
case CAPE:
NetworkPlayerInfo.this.playerTextures.put(Type.CAPE, location);
break;
case ELYTRA:
NetworkPlayerInfo.this.playerTextures.put(Type.ELYTRA, location);
}
}
}, true);
}
}
}