From 99401877e1e18ce56cdd1909443eea09dcdb2521 Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Mon, 28 Dec 2015 20:20:07 -0500 Subject: [PATCH] Add separate left wing texture right below current texture --- .../voxelmodpack/hdskins/HDSkinDownload.java | 1 + .../voxelmodpack/hdskins/HDSkinManager.java | 15 ++++++++++++ .../voxelmodpack/hdskins/ISkinModifier.java | 9 +++++++ .../hdskins/ImageBufferDownloadHD.java | 7 ++++-- .../minelittlepony/MineLittlePony.java | 1 + .../minelittlepony/PonySkinModifier.java | 23 ++++++++++++++++++ .../model/part/PegasusWings.java | 6 ++--- .../textures/entity/steve_pony.png | Bin 775 -> 1401 bytes 8 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 src/hdskins/java/com/voxelmodpack/hdskins/ISkinModifier.java create mode 100644 src/main/java/com/brohoof/minelittlepony/PonySkinModifier.java 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 09af694c930948f104e72a8378ad84445b4dfb1a..c0bbf70a5b9766932d795ee98c9b6069eea169ed 100644 GIT binary patch delta 1383 zcmV-t1(^DW2Kfq*BYyw}VoOIv0RI600RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_ z000McNliru-wYi98y*`5kl+9S1qMk(K~#9!?OR_+TUQ+ZZs$fHWOdUTYqitJI@61w zwi`7Lv9nMZD;rtG}4Cf))l7r+;&lj`pRtrL0<78U?vE zRT8tA)kSS*hKw;7cMtB|-JIOqKgqpD)AK>N$vO9&d%o}fe!p|>@8oh{KiCkzcqfm; zfB5-ks|XoxFW8`l6NjU!^>=@NDeiY@eiZ;92vJ<>I0Cn47E7xk06=-69d^DFwxS|9 z91h&Negof*|9`+C4SX}!E~?e%$jJl1s6T>MS3ZU(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