当前位置: 首页>>代码示例>>Java>>正文


Java MinecraftProfileTexture类代码示例

本文整理汇总了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;
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:18,代码来源:EntityMiniMe.java

示例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);
        }
    }
}
 
开发者ID:ProxyNeko,项目名称:Proxys-Lib,代码行数:20,代码来源:SpecialPeopleCapeHandler.java

示例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);
        }
    }
}
 
开发者ID:ProxyNeko,项目名称:Proxys-Lib,代码行数:20,代码来源:NekoCapeHandler.java

示例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();
            }
        }
    });
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:SkinManager.java

示例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);
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:23,代码来源:DownloadedTextures.java

示例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);
          }
      }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:24,代码来源:DownloadedTextures.java

示例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;
}
 
开发者ID:mchorse,项目名称:metamorph,代码行数:27,代码来源:PlayerMorph.java

示例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;
}
 
开发者ID:mchorse,项目名称:metamorph,代码行数:21,代码来源:PlayerMorph.java

示例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));
    }
}
 
开发者ID:MineLittlePony,项目名称:MineLittlePony,代码行数:17,代码来源:MixinPlayerInfo.java

示例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;
}
 
开发者ID:NightKosh,项目名称:Gravestone-mod-Extended,代码行数:21,代码来源:GameProfileHelper.java

示例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);
		
	}
}
 
开发者ID:NomNuggetNom,项目名称:mcpvp-mod,代码行数:31,代码来源:AllRender.java

示例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);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:33,代码来源:NetworkPlayerInfo.java

示例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);
        }
    });
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:14,代码来源:SkinManager.java

示例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;
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:40,代码来源:NewSkinManager.java

示例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);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:37,代码来源:NetworkPlayerInfo.java


注:本文中的com.mojang.authlib.minecraft.MinecraftProfileTexture类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。