mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 04:27:59 +01:00
Add separate left wing texture right below current texture
This commit is contained in:
parent
69d1f76ada
commit
99401877e1
8 changed files with 56 additions and 6 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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<String, String> playerHashes = Maps.newHashMap();
|
||||
private static final Map<String, Map<Type, MinecraftProfileTexture>> cachedTextures = Maps.newHashMap();
|
||||
|
||||
private static List<ISkinModifier> skinModifiers = Lists.newArrayList();
|
||||
|
||||
public static void onDownloadSkin(EventInfo<ThreadDownloadImageData> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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++) {
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 775 B After Width: | Height: | Size: 1.4 KiB |
Loading…
Reference in a new issue