本文整理汇总了Java中com.mojang.authlib.minecraft.MinecraftProfileTexture.Type方法的典型用法代码示例。如果您正苦于以下问题:Java MinecraftProfileTexture.Type方法的具体用法?Java MinecraftProfileTexture.Type怎么用?Java MinecraftProfileTexture.Type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mojang.authlib.minecraft.MinecraftProfileTexture
的用法示例。
在下文中一共展示了MinecraftProfileTexture.Type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
示例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/dev_cape.png");
textures.put(MinecraftProfileTexture.Type.CAPE, loc);
textures.put(MinecraftProfileTexture.Type.ELYTRA, loc);
done.add(player);
}
}
}
示例3: 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);
}
示例4: 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;
}
示例5: onSetLocalSkin
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入方法依赖的package包/类
@Override
protected void onSetLocalSkin(MinecraftProfileTexture.Type type) {
MineLittlePony.logger.debug("Invalidating old local skin, checking updated local skin");
if (type == MinecraftProfileTexture.Type.SKIN) {
ponyManager.removePony(this.localPlayer.getSkinTexture());
}
}
示例6: onSetRemoteSkin
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入方法依赖的package包/类
@Override
protected void onSetRemoteSkin(MinecraftProfileTexture.Type type, ResourceLocation location, MinecraftProfileTexture profileTexture) {
MineLittlePony.logger.debug("Invalidating old remote skin, checking updated remote skin");
if (type == MinecraftProfileTexture.Type.SKIN) {
ponyManager.removePony(location);
}
}
示例7: loadProfileData
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入方法依赖的package包/类
@Override
public Optional<MinecraftTexturesPayload> loadProfileData(GameProfile profile) {
ImmutableMap.Builder<MinecraftProfileTexture.Type, MinecraftProfileTexture> builder = ImmutableMap.builder();
for (MinecraftProfileTexture.Type type : MinecraftProfileTexture.Type.values()) {
String url = getPath(this.address, type, profile);
try {
HttpURLConnection urlConnection = (HttpURLConnection) new URL(url).openConnection();
if (urlConnection.getResponseCode() / 100 != 2) {
throw new IOException("Bad response code: " + urlConnection.getResponseCode());
}
builder.put(type, new MinecraftProfileTexture(url, null));
logger.debug("Found skin for {} at {}", profile.getName(), url);
} catch (IOException e) {
logger.trace("Couldn't find texture for {} at {}. Does it exist?", profile.getName(), url, e);
}
}
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = builder.build();
if (map.isEmpty()) {
logger.debug("No textures found for {} at {}", profile, this.address);
return Optional.empty();
}
return Optional.of(new TexturesPayloadBuilder()
.profileId(profile.getId())
.profileName(profile.getName())
.timestamp(System.currentTimeMillis())
.isPublic(true)
.textures(map)
.build());
}
示例8: uploadSkin
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入方法依赖的package包/类
@Override
public ListenableFuture<SkinUploadResponse> uploadSkin(Session session, @Nullable Path image, MinecraftProfileTexture.Type type) {
if (Strings.isNullOrEmpty(this.gateway))
return Futures.immediateFailedFuture(new NullPointerException("gateway url is blank"));
return HDSkinManager.skinUploadExecutor.submit(() -> {
verifyServerConnection(session, SERVER_ID);
Map<String, ?> data = image == null ? getClearData(session, type) : getUploadData(session, type, image);
ThreadMultipartPostUpload upload = new ThreadMultipartPostUpload(this.gateway, data);
String response = upload.uploadMultipart();
return new SkinUploadResponse(response.equalsIgnoreCase("OK"), response);
});
}
示例9: getData
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入方法依赖的package包/类
private static Map<String, ?> getData(Session session, MinecraftProfileTexture.Type type, String param, Object val) {
return ImmutableMap.of(
"user", session.getUsername(),
"uuid", session.getPlayerID(),
"type", type.toString().toLowerCase(Locale.US),
param, val);
}
示例10: getPreviewTexture
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入方法依赖的package包/类
@Override
public Optional<MinecraftProfileTexture> getPreviewTexture(MinecraftProfileTexture.Type type, GameProfile profile) {
if (Strings.isNullOrEmpty(this.gateway))
return Optional.empty();
return Optional.of(new MinecraftProfileTexture(getPath(this.gateway, type, profile), null));
}
示例11: getClearData
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入方法依赖的package包/类
private static Map<String, ?> getClearData(Session session, MinecraftProfileTexture.Type type) {
return getData(session, type, "clear", "1");
}
示例12: getUploadData
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入方法依赖的package包/类
private static Map<String, ?> getUploadData(Session session, MinecraftProfileTexture.Type type, Path skinFile) {
return getData(session, type, type.toString().toLowerCase(Locale.US), skinFile);
}
示例13: getPath
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入方法依赖的package包/类
private static String getPath(String address, MinecraftProfileTexture.Type type, GameProfile profile) {
String uuid = UUIDTypeAdapter.fromUUID(profile.getId());
String path = type.toString().toLowerCase() + "s";
return String.format("%s/%s/%s.png", address, path, uuid);
}
示例14: getPreviewTexture
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入方法依赖的package包/类
@Override
public Optional<MinecraftProfileTexture> getPreviewTexture(MinecraftProfileTexture.Type type, GameProfile profile) {
return null;
}
示例15: uploadSkin
import com.mojang.authlib.minecraft.MinecraftProfileTexture; //导入方法依赖的package包/类
@Override
public ListenableFuture<SkinUploadResponse> uploadSkin(Session session, @Nullable Path image, MinecraftProfileTexture.Type type) {
return null;
}