mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-25 19:14:30 +00:00
Changes to ModelMPM and Renderer
Attempting to get SkinUrls to match for 1.8 Skins
This commit is contained in:
1 parent
5cbcdb293e
commit
9ddbf2ee45
12 files changed
+140
-29
No files matched your search
@@ -3,6 +3,7 @@ package noppes.npcs.client.renderer;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
import java.awt.image.ImageObserver;
|
||||
|
||||
import net.minecraft.client.renderer.ImageBufferDownload;
|
||||
|
||||
@@ -11,21 +12,41 @@ public class ImageBufferDownloadAlt extends ImageBufferDownload
|
||||
private int imageData[];
|
||||
private int imageWidth;
|
||||
private int imageHeight;
|
||||
private boolean NPC64;
|
||||
|
||||
public ImageBufferDownloadAlt(){
|
||||
NPC64 = false;
|
||||
}
|
||||
|
||||
public ImageBufferDownloadAlt(boolean type){
|
||||
NPC64 = type;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BufferedImage parseUserSkin(BufferedImage bufferedimage)
|
||||
{
|
||||
imageWidth = bufferedimage.getWidth(null);
|
||||
imageHeight = imageWidth / 2;
|
||||
|
||||
{
|
||||
|
||||
imageWidth = bufferedimage.getWidth(null);
|
||||
|
||||
if(NPC64){
|
||||
imageHeight = bufferedimage.getHeight(null);
|
||||
}
|
||||
else{
|
||||
imageHeight = imageWidth / 2;
|
||||
}
|
||||
|
||||
BufferedImage bufferedimage1 = new BufferedImage(imageWidth, imageHeight, 2);
|
||||
Graphics g = bufferedimage1.getGraphics();
|
||||
g.drawImage(bufferedimage, 0, 0, null);
|
||||
g.dispose();
|
||||
imageData = ((DataBufferInt)bufferedimage1.getRaster().getDataBuffer()).getData();
|
||||
|
||||
setAreaTransparent(imageWidth / 2, 0, imageWidth, imageHeight / 2);
|
||||
|
||||
return bufferedimage1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the given area of the image transparent if it was previously completely opaque (used to remove the outer
|
||||
* layer of a skin around the head if it was saved all opaque; this would be redundant so it's assumed that the skin
|
||||
|
||||
@@ -24,12 +24,16 @@ public class RenderCustomNpc extends RenderNPCHumanMale{
|
||||
|
||||
private ModelRenderPassHelper renderpass = new ModelRenderPassHelper();
|
||||
|
||||
// Default Renderer
|
||||
public RenderCustomNpc() {
|
||||
super(new ModelMPM(0), new ModelMPM(1), new ModelMPM(0.5f));
|
||||
}
|
||||
|
||||
public RenderCustomNpc(int i) {
|
||||
super(new ModelMPM(0, true), new ModelMPM(1, true), new ModelMPM(0.5f, true));
|
||||
// 64x64 Version
|
||||
// True = Alex Arms
|
||||
// False = Steve Arms
|
||||
public RenderCustomNpc(boolean arms) {
|
||||
super(new ModelMPM(0, arms), new ModelMPM(1, arms), new ModelMPM(0.5f, arms));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -306,7 +306,7 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
sb.append(String.format("%02x", b&0xff));
|
||||
}
|
||||
npc.textureLocation = new ResourceLocation("skins/" + sb.toString());
|
||||
func_110301_a(null, npc.textureLocation, npc.display.url);
|
||||
loadSkin(null, npc.textureLocation, npc.display.url);
|
||||
LastTextureTick = 0;
|
||||
}
|
||||
catch(Exception ex){
|
||||
@@ -319,9 +319,10 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
return npc.textureLocation;
|
||||
}
|
||||
|
||||
private void func_110301_a(File file, ResourceLocation resource, String par1Str){
|
||||
private void loadSkin(File file, ResourceLocation resource, String par1Str){
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||
ITextureObject object = new ImageDownloadAlt(file, par1Str, SkinManager.field_152793_a, new ImageBufferDownloadAlt());
|
||||
texturemanager.loadTexture(resource, object);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user