From bf5b1416879059c184fa96f8ca58720c10a3d25c Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Mon, 14 Nov 2016 00:38:24 -0500 Subject: [PATCH] Fix hd skin loading --- build.gradle | 2 +- build.number | 4 ++-- .../voxelmodpack/hdskins/HDSkinManager.java | 5 +++-- .../voxelmodpack/hdskins/TextureLoader.java | 19 +++++++++++++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 src/hdskins/java/com/voxelmodpack/hdskins/TextureLoader.java diff --git a/build.gradle b/build.gradle index 7b7c4f28..3ff7bdeb 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'org.spongepowered.mixin' apply plugin: 'mnm.gradle.ap-ide' group = 'com.brohoof.minelp' -version = '1.10.2.5' +version = '1.10.2.6' description = 'Mine Little Pony' minecraft { diff --git a/build.number b/build.number index 8cd7f949..ac47a096 100644 --- a/build.number +++ b/build.number @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Sat Nov 12 03:22:49 EST 2016 -build.number=254 +#Mon Nov 14 00:39:19 EST 2016 +build.number=255 diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinManager.java b/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinManager.java index 44fff80f..8ddf6e70 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinManager.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinManager.java @@ -153,7 +153,8 @@ public final class HDSkinManager implements IResourceManagerReloadListener { } }); - Minecraft.getMinecraft().getTextureManager().loadTexture(skin, threaddownloadimagedata); + // schedule texture loading on the main thread. + TextureLoader.loadTexture(skin, threaddownloadimagedata); } } @@ -246,7 +247,7 @@ public final class HDSkinManager implements IResourceManagerReloadListener { if (skin != null) { String url = INSTANCE.getCustomTextureURLForId(Type.SKIN, UUIDTypeAdapter.fromUUID(profile.getId()), true); skinTexture = new PreviewTexture(url, DefaultPlayerSkin.getDefaultSkin(profile.getId()), new ImageBufferDownloadHD()); - textureManager.loadTexture(skinResource, skinTexture); + TextureLoader.loadTexture(skinResource, skinTexture); } return (PreviewTexture) skinTexture; diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/TextureLoader.java b/src/hdskins/java/com/voxelmodpack/hdskins/TextureLoader.java new file mode 100644 index 00000000..1474dee9 --- /dev/null +++ b/src/hdskins/java/com/voxelmodpack/hdskins/TextureLoader.java @@ -0,0 +1,19 @@ +package com.voxelmodpack.hdskins; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.util.ResourceLocation; + +public class TextureLoader { + + private static Minecraft mc = Minecraft.getMinecraft(); + + public static void loadTexture(final ResourceLocation textureLocation, final ITextureObject textureObj) { + mc.addScheduledTask(new Runnable() { + @Override + public void run() { + mc.getTextureManager().loadTexture(textureLocation, textureObj); + } + }); + } +}