MineLittlePony/src/main/java/com/minelittlepony/PonySkinModifier.java

36 lines
1.2 KiB
Java
Raw Normal View History

2016-11-17 05:45:04 +01:00
package com.minelittlepony;
2016-11-25 05:40:19 +01:00
import com.voxelmodpack.hdskins.ISkinModifier;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;
public class PonySkinModifier implements ISkinModifier {
@Override
public void convertSkin(BufferedImage skin, Graphics dest) {
int scale = skin.getWidth() / 64;
2016-03-16 05:41:42 +01:00
//top, mirror
2016-04-07 05:16:50 +02:00
drawImage(dest, skin, scale, 60, 32, 58, 34, 58, 16, 60, 18);
2016-03-16 05:41:42 +01:00
//bottom, mirror
2016-04-07 05:16:50 +02:00
drawImage(dest, skin, scale, 62, 32, 60, 34, 60, 16, 62, 18);
2016-03-16 05:41:42 +01:00
//inside
2016-04-07 05:16:50 +02:00
drawImage(dest, skin, scale, 58, 34, 56, 48, 60, 18, 62, 32);
//back
drawImage(dest, skin, scale, 60, 34, 58, 48, 58, 18, 60, 32);
2016-03-16 05:41:42 +01:00
//outside
2016-04-07 05:16:50 +02:00
drawImage(dest, skin, scale, 62, 34, 60, 48, 56, 18, 58, 32);
2016-03-16 05:41:42 +01:00
//back
2016-04-07 05:16:50 +02:00
drawImage(dest, skin, scale, 64, 34, 62, 48, 62, 18, 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);
}
}