diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinDownload.java b/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinDownload.java index 3a117beb..e390cb35 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinDownload.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinDownload.java @@ -31,6 +31,7 @@ class HDSkinDownload extends Thread { public void run() { Proxy proxy = Minecraft.getMinecraft().getProxy(); if (!this.tryDownload(proxy, this.skinUrl) && this.originalThread != null) { + PrivateFields.imageBuffer.set(image, imageBuffer); this.originalThread.run(); } diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinManager.java b/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinManager.java index d4f1070b..7ce75b20 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinManager.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinManager.java @@ -1,5 +1,7 @@ package com.voxelmodpack.hdskins; +import java.awt.Graphics; +import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.Collection; @@ -12,6 +14,7 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import com.google.common.cache.Cache; +import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.InsecureTextureException; @@ -41,6 +44,8 @@ public final class HDSkinManager { private static final Map playerHashes = Maps.newHashMap(); private static final Map> cachedTextures = Maps.newHashMap(); + private static List skinModifiers = Lists.newArrayList(); + public static void onDownloadSkin(EventInfo e) { ThreadDownloadImageData imageDownload = e.getSource(); if (imageDownload != null) { @@ -259,4 +264,14 @@ public final class HDSkinManager { cachedTextures.clear(); playerHashes.clear(); } + + public static void addSkinModifier(ISkinModifier modifier) { + skinModifiers.add(modifier); + } + + static void updateSkin(BufferedImage image, Graphics dest) { + for (ISkinModifier skin : skinModifiers) { + skin.convertSkin(image, dest); + } + } } diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/ISkinModifier.java b/src/hdskins/java/com/voxelmodpack/hdskins/ISkinModifier.java new file mode 100644 index 00000000..4fbb6302 --- /dev/null +++ b/src/hdskins/java/com/voxelmodpack/hdskins/ISkinModifier.java @@ -0,0 +1,9 @@ +package com.voxelmodpack.hdskins; + +import java.awt.Graphics; +import java.awt.image.BufferedImage; + +public interface ISkinModifier { + + void convertSkin(BufferedImage skin, Graphics dest); +} diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/ImageBufferDownloadHD.java b/src/hdskins/java/com/voxelmodpack/hdskins/ImageBufferDownloadHD.java index 4c7438e5..3b3eda40 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/ImageBufferDownloadHD.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/ImageBufferDownloadHD.java @@ -38,11 +38,14 @@ public class ImageBufferDownloadHD implements IImageBuffer { // arm drawImage(40, 48, 36, 52, 44, 16, 48, 20); // top drawImage(44, 48, 40, 52, 48, 16, 52, 20); // bottom - drawImage(36, 52, 32, 64, 48, 20, 52, 32); // - drawImage(40, 52, 36, 64, 44, 20, 48, 32); // + drawImage(36, 52, 32, 64, 48, 20, 52, 32); + drawImage(40, 52, 36, 64, 44, 20, 48, 32); drawImage(44, 52, 40, 64, 40, 20, 44, 32); drawImage(48, 52, 44, 64, 52, 20, 56, 32); + // mod things + HDSkinManager.updateSkin(image, graphics); + graphics.dispose(); return image; } diff --git a/src/main/java/com/brohoof/minelittlepony/MineLittlePony.java b/src/main/java/com/brohoof/minelittlepony/MineLittlePony.java index b2666ab4..76958603 100644 --- a/src/main/java/com/brohoof/minelittlepony/MineLittlePony.java +++ b/src/main/java/com/brohoof/minelittlepony/MineLittlePony.java @@ -87,6 +87,7 @@ public class MineLittlePony implements InitCompleteListener { HDSkinManager.clearSkinCache(); HDSkinManager.setSkinUrl(SKIN_SERVER_URL); HDSkinManager.setGatewayURL(GATEWAY_URL); + HDSkinManager.addSkinModifier(new PonySkinModifier()); MineLPLogger.info("Set MineLP skin server URL."); } RenderManager rm = minecraft.getRenderManager(); diff --git a/src/main/java/com/brohoof/minelittlepony/PonySkinModifier.java b/src/main/java/com/brohoof/minelittlepony/PonySkinModifier.java new file mode 100644 index 00000000..ff09a2dc --- /dev/null +++ b/src/main/java/com/brohoof/minelittlepony/PonySkinModifier.java @@ -0,0 +1,23 @@ +package com.brohoof.minelittlepony; + +import java.awt.Graphics; +import java.awt.Image; +import java.awt.image.BufferedImage; + +import com.voxelmodpack.hdskins.ISkinModifier; + +public class PonySkinModifier implements ISkinModifier { + + @Override + public void convertSkin(BufferedImage skin, Graphics dest) { + int scale = skin.getWidth() / 64; + drawImage(dest, skin, scale, 64, 32, 56, 48, 56, 16, 64, 32); + } + + private void drawImage(Graphics graphics, Image image, int scale, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) { + graphics.drawImage(image, + dx1 * scale, dy1 * scale, dx2 * scale, dy2 * scale, + sx1 * scale, sy1 * scale, sx2 * scale, sy2 * scale, + null); + } +} diff --git a/src/main/java/com/brohoof/minelittlepony/model/part/PegasusWings.java b/src/main/java/com/brohoof/minelittlepony/model/part/PegasusWings.java index 191604fd..276b2b22 100644 --- a/src/main/java/com/brohoof/minelittlepony/model/part/PegasusWings.java +++ b/src/main/java/com/brohoof/minelittlepony/model/part/PegasusWings.java @@ -35,8 +35,7 @@ public class PegasusWings implements IPonyPart, PonyModelConstants { this.compressiveRightWing = new CompressiveRendering(pony); for (int i = 0; i < leftWing.length; i++) { - this.leftWing[i] = new ModelRenderer(pony, 56, 16); - this.leftWing[i].mirror = true; + this.leftWing[i] = new ModelRenderer(pony, 56, 32); this.compressiveLeftWing.addCompressed(this.leftWing[i]); } for (int i = 0; i < rightWing.length; i++) { @@ -44,8 +43,7 @@ public class PegasusWings implements IPonyPart, PonyModelConstants { this.compressiveRightWing.addCompressed(this.rightWing[i]); } for (int i = 0; i < leftWingExt.length; i++) { - this.leftWingExt[i] = new ModelRenderer(pony, 56, 19); - this.leftWingExt[i].mirror = true; + this.leftWingExt[i] = new ModelRenderer(pony, 56, 35); this.compressiveLeftWing.addExpanded(this.leftWingExt[i]); } for (int i = 0; i < rightWingExt.length; i++) { diff --git a/src/main/resources/assets/minelittlepony/textures/entity/steve_pony.png b/src/main/resources/assets/minelittlepony/textures/entity/steve_pony.png index 09af694c..c0bbf70a 100644 Binary files a/src/main/resources/assets/minelittlepony/textures/entity/steve_pony.png and b/src/main/resources/assets/minelittlepony/textures/entity/steve_pony.png differ