com.mojang.authlib.minecraft.MinecraftProfileTexture.Type Java Examples
The following examples show how to use
com.mojang.authlib.minecraft.MinecraftProfileTexture.Type.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlayerSkinProviderMixin.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Shadow public Identifier loadSkin(MinecraftProfileTexture profileTexture, Type type, @Nullable PlayerSkinProvider.SkinTextureAvailableCallback callback) { return null; }
Example #2
Source File: ClientProxy.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent public static void onPlayerRender(RenderPlayerEvent.Pre event) { AbstractClientPlayer clientPlayer = (AbstractClientPlayer) event.getEntityPlayer(); if (capeHoldersUUIDs.contains(clientPlayer.getUniqueID()) && clientPlayer.hasPlayerInfo() && clientPlayer.getLocationCape() == null) { NetworkPlayerInfo playerInfo = ObfuscationReflectionHelper.getPrivateValue(AbstractClientPlayer.class, clientPlayer, 0); Map<Type, ResourceLocation> playerTextures = ObfuscationReflectionHelper.getPrivateValue(NetworkPlayerInfo.class, playerInfo, 1); playerTextures.put(Type.CAPE, GREGTECH_CAPE_TEXTURE); } }
Example #3
Source File: NewSkinManager.java From Et-Futurum with The Unlicense | 5 votes |
@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; }
Example #4
Source File: PlayerSkinProviderMixin.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
@Inject(at = {@At("HEAD")}, method = { "loadSkin(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/texture/PlayerSkinProvider$SkinTextureAvailableCallback;Z)V"}, cancellable = true) private void onLoadSkin(GameProfile profile, PlayerSkinProvider.SkinTextureAvailableCallback callback, boolean requireSecure, CallbackInfo ci) { // Can't @Inject nicely because everything is wrapped in a lambda. // Had to replace the whole method. Runnable runnable = () -> { HashMap<MinecraftProfileTexture.Type, MinecraftProfileTexture> map = Maps.newHashMap(); try { map.putAll(sessionService.getTextures(profile, requireSecure)); }catch(InsecureTextureException var7) { } if(map.isEmpty()) { profile.getProperties().clear(); if(profile.getId().equals(MinecraftClient.getInstance() .getSession().getProfile().getId())) { profile.getProperties().putAll( MinecraftClient.getInstance().getSessionProperties()); map.putAll(sessionService.getTextures(profile, false)); }else { sessionService.fillProfileProperties(profile, requireSecure); try { map.putAll( sessionService.getTextures(profile, requireSecure)); }catch(InsecureTextureException var6) { } } } addWurstCape(profile, map); MinecraftClient.getInstance().execute(() -> { RenderSystem.recordRenderCall(() -> { ImmutableList.of(Type.SKIN, Type.CAPE).forEach((type) -> { if(map.containsKey(type)) loadSkin(map.get(type), type, callback); }); }); }); }; Util.getServerWorkerExecutor().execute(runnable); ci.cancel(); }
Example #5
Source File: TileEntityFancySkullRenderer.java From Et-Futurum with The Unlicense | 4 votes |
@SuppressWarnings("unchecked") public void renderSkull(float x, float y, float z, int meta, float rotation, int type, GameProfile profile) { ModelHead model = model1; switch (type) { case 0: default: bindTexture(skeleton_texture); break; case 1: bindTexture(wither_skeleton_texture); break; case 2: bindTexture(zombie_texture); model = model2; break; case 3: ResourceLocation texture = AbstractClientPlayer.locationStevePng; if (profile != null) { Minecraft minecraft = Minecraft.getMinecraft(); Map<Type, MinecraftProfileTexture> map = minecraft.func_152342_ad().func_152788_a(profile); if (map.containsKey(Type.SKIN)) texture = minecraft.func_152342_ad().func_152792_a(map.get(Type.SKIN), Type.SKIN); } bindTexture(texture); break; case 4: bindTexture(creeper_texture); } OpenGLHelper.pushMatrix(); OpenGLHelper.disableCull(); if (meta != 1) switch (meta) { case 2: OpenGLHelper.translate(x + 0.5F, y + 0.25F, z + 0.74F); break; case 3: OpenGLHelper.translate(x + 0.5F, y + 0.25F, z + 0.26F); rotation = 180.0F; break; case 4: OpenGLHelper.translate(x + 0.74F, y + 0.25F, z + 0.5F); rotation = 270.0F; break; case 5: default: OpenGLHelper.translate(x + 0.26F, y + 0.25F, z + 0.5F); rotation = 90.0F; } else GL11.glTranslatef(x + 0.5F, y, z + 0.5F); OpenGLHelper.enableRescaleNormal(); OpenGLHelper.scale(-1.0F, -1.0F, 1.0F); OpenGLHelper.enableAlpha(); model.render(rotation); OpenGLHelper.popMatrix(); }
Example #6
Source File: ISkinDownloadCallback.java From Et-Futurum with The Unlicense | 2 votes |
/** * Gets called when a 1.8 style skin is downloaded */ @Override void func_152121_a(Type skinType, ResourceLocation resourceLocation);