mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 00:17:27 +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
@@ -201,8 +201,9 @@ public class CustomNpcs {
|
||||
registerNpc(EntityNpcDragon.class, "NpcDragon");
|
||||
registerNpc(EntityNPCEnderman.class, "npcEnderman");
|
||||
registerNpc(EntityNPCGolem.class, "npcGolem");
|
||||
registerNpc(EntityCustomNpc.class, "CustomNpc");
|
||||
registerNpc(EntityNPC64x64.class, "CustomNpc64");
|
||||
registerNpc(EntityCustomNpc.class, "CustomNpc");
|
||||
|
||||
|
||||
|
||||
registerNewEntity(EntityChairMount.class, "CustomNpcChairMount", 64, 10, false);
|
||||
|
||||
@@ -58,7 +58,7 @@ public class DataDisplay {
|
||||
"Embrera", "Eldamore", "Faolan", "Chim", "Nasu", "Kathrine", "Ariel", "Arei", "Demytrix",
|
||||
"Kora", "Ava", "Larson", "Leonardo", "Wyrl", "Sakiama", "Lambton", "Kederath", "Malus", "Riplette",
|
||||
"Andern", "Ezall", "Lucien", "Droco", "Cray", "Tymen", "Zenix", "Entranger",
|
||||
"Saenorath", "Chris", "Christine", "Marble", "Mable", "Ross", "Rose", "Xalgan ", "Kennet"
|
||||
"Saenorath", "Chris", "Christine", "Marble", "Mable", "Ross", "Rose", "Xalgan ", "Kennet", "Kamkeel"
|
||||
};
|
||||
name = names[new Random().nextInt(names.length)];
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
// Changes Made Here:
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityCustomNpc.class, new RenderCustomNpc());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNPC64x64.class, new RenderCustomNpc(1));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNPC64x64.class, new RenderCustomNpc(false)); // False for Steve
|
||||
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNPCGolem.class, new RenderNPCHumanMale(
|
||||
|
||||
@@ -63,7 +63,7 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
|
||||
} catch (NoSuchMethodException e) {
|
||||
}
|
||||
}
|
||||
data.put("NPC64", EntityNPC64x64.class);
|
||||
data.put("CustomNPC64x64", EntityNPC64x64.class);
|
||||
list = new ArrayList<String>(data.keySet());
|
||||
Collections.sort(list,String.CASE_INSENSITIVE_ORDER);
|
||||
}
|
||||
|
||||
@@ -121,49 +121,43 @@ public class ModelMPM extends ModelNPCMale{
|
||||
|
||||
public ModelMPM(float par1, boolean arms) {
|
||||
|
||||
super(par1);
|
||||
super(par1, true);
|
||||
isArmor = par1 > 0;
|
||||
float par2 = 0;
|
||||
|
||||
// Changed Texture Size
|
||||
int short1 = 64;
|
||||
int short2 = 64;
|
||||
|
||||
this.bipedCloak = new ModelRenderer(this, 0, 0);
|
||||
this.bipedCloak.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, par1);
|
||||
|
||||
this.bipedEars = new ModelRenderer(this, 24, 0);
|
||||
this.bipedEars.addBox(-3.0F, -6.0F, -1.0F, 6, 6, 1, par1);
|
||||
|
||||
this.bipedHead = (new ModelScaleRenderer(this, 0, 0)).setTextureSize(short1, short2);
|
||||
this.bipedHead = (new ModelScaleRenderer(this, 0, 0));
|
||||
this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1);
|
||||
this.bipedHead.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
|
||||
|
||||
this.bipedHeadwear = (new ModelScaleRenderer(this, 32, 0)).setTextureSize(short1, short2);
|
||||
this.bipedHeadwear = (new ModelScaleRenderer(this, 32, 0));
|
||||
this.bipedHeadwear.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, par1 + 0.5F);
|
||||
this.bipedHeadwear.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
|
||||
|
||||
this.bipedBody = (new ModelScaleRenderer(this, 16, 16)).setTextureSize(short1, short2);
|
||||
this.bipedBody = (new ModelScaleRenderer(this, 16, 16));
|
||||
this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, par1);
|
||||
this.bipedBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
|
||||
|
||||
this.bipedRightArm = (new ModelScaleRenderer(this, 40, 16)).setTextureSize(short1, short2);
|
||||
this.bipedRightArm = (new ModelScaleRenderer(this, 40, 16));
|
||||
this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1);
|
||||
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + par2, 0.0F);
|
||||
|
||||
// Changed Texture Size
|
||||
this.bipedLeftArm = (new ModelScaleRenderer(this, 32, 48)).setTextureSize(short1, short2);
|
||||
this.bipedLeftArm.mirror = true;
|
||||
// Changed for 64x64 Texture
|
||||
this.bipedLeftArm = new ModelScaleRenderer(this, 32, 48);
|
||||
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, par1);
|
||||
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + par2, 0.0F);
|
||||
|
||||
this.bipedRightLeg = (new ModelScaleRenderer(this, 0, 16)).setTextureSize(short1, short2);
|
||||
this.bipedRightLeg = (new ModelScaleRenderer(this, 0, 16));
|
||||
this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1);
|
||||
this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + par2, 0.0F);
|
||||
|
||||
// Changed Texture Size
|
||||
this.bipedLeftLeg = (new ModelScaleRenderer(this, 16, 48)).setTextureSize(short1, short2);
|
||||
this.bipedLeftLeg.mirror = true;
|
||||
// Changed for 64x64 Texture
|
||||
this.bipedLeftLeg = new ModelScaleRenderer(this, 16, 48);
|
||||
this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1);
|
||||
this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + par2, 0.0F);
|
||||
|
||||
|
||||
@@ -25,17 +25,85 @@ public class ModelNPCMale extends ModelBiped
|
||||
{
|
||||
init(f, 0.0F);
|
||||
}
|
||||
|
||||
public ModelNPCMale(float f, boolean newSteve)
|
||||
{
|
||||
super(f, 0.0F, 64, 64);
|
||||
init(f, 0.0F, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLivingAnimations(EntityLivingBase par1EntityLiving, float f6, float f5, float par9){
|
||||
animationTick += par9;
|
||||
dancingTicks = CustomNpcs.ticks / 3.978873F;
|
||||
}
|
||||
|
||||
|
||||
// 64x64 Skin
|
||||
public void init(float f, float f1, boolean NewSteve)
|
||||
{
|
||||
|
||||
heldItemLeft = 0;
|
||||
heldItemRight = 0;
|
||||
isSneak = false;
|
||||
aimedBow = false;
|
||||
|
||||
// Changed
|
||||
bipedCloak = new ModelRenderer(this, 0, 0);
|
||||
bipedCloak.setTextureSize(64, 32);
|
||||
bipedCloak.addBox(-5.0F, 0.0F, -1.0F, 10, 16, 1, f);
|
||||
|
||||
// Same
|
||||
bipedEars = new ModelRenderer(this, 24, 0);
|
||||
bipedEars.setTextureSize(64, 32); // NEW LINE
|
||||
bipedEars.addBox(-3F, -6F, -1F, 6, 6, 1, f);
|
||||
|
||||
bipedHead = new ModelRenderer(this, 0, 0);
|
||||
bipedHead.addBox(-4F, -8F, -4F, 8, 8, 8, f);
|
||||
bipedHead.setRotationPoint(0.0F, 0.0F + f1, 0.0F);
|
||||
|
||||
bipedHeadwear = new ModelRenderer(this, 32, 0);
|
||||
bipedHeadwear.addBox(-4F, -8F, -4F, 8, 8, 8, f + 0.5F);
|
||||
bipedHeadwear.setRotationPoint(0.0F, 0.0F + f1, 0.0F);
|
||||
|
||||
bipedBody = new ModelRenderer(this, 16, 16);
|
||||
bipedBody.addBox(-4F, 0.0F, -2F, 8, 12, 4, f);
|
||||
bipedBody.setRotationPoint(0.0F, 0.0F + f1, 0.0F);
|
||||
|
||||
|
||||
bipedRightArm = new ModelRenderer(this, 40, 16);
|
||||
bipedRightArm.addBox(-3F, -2F, -2F, 4, 12, 4, f);
|
||||
bipedRightArm.setRotationPoint(-5F, 2.0F + f1, 0.0F);
|
||||
|
||||
// Changed
|
||||
bipedLeftArm = new ModelRenderer(this, 32, 48);
|
||||
bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, f);
|
||||
bipedLeftArm.setRotationPoint(5.0F, 2.0F + f1, 0.0F);
|
||||
|
||||
bipedRightLeg = new ModelRenderer(this, 0, 16);
|
||||
bipedRightLeg.addBox(-2F, 0.0F, -2F, 4, 12, 4, f);
|
||||
bipedRightLeg.setRotationPoint(-2F, 12F + f1, 0.0F);
|
||||
|
||||
// Changed
|
||||
bipedLeftLeg = new ModelRenderer(this, 16, 48);
|
||||
bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, f);
|
||||
bipedLeftLeg.setRotationPoint(1.9F, 12.0F + f1, 0.0F);
|
||||
|
||||
bipedLeftLeg = new ModelRenderer(this, 0, 16);
|
||||
bipedLeftLeg.mirror = true;
|
||||
bipedLeftLeg.addBox(-2F, 0.0F, -2F, 4, 12, 4, f);
|
||||
bipedLeftLeg.setRotationPoint(2.0F, 12F + f1, 0.0F);
|
||||
|
||||
}
|
||||
|
||||
// 64x32
|
||||
public void init(float f, float f1)
|
||||
{
|
||||
heldItemLeft = 0;
|
||||
heldItemRight = 0;
|
||||
isSneak = false;
|
||||
aimedBow = false;
|
||||
|
||||
bipedCloak = new ModelRenderer(this, 0, 0);
|
||||
bipedCloak.textureHeight = 32;
|
||||
bipedCloak.addBox(-5F, 0.0F, -1F, 10, 16, 1, f);
|
||||
@@ -70,6 +138,9 @@ public class ModelNPCMale extends ModelBiped
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7){
|
||||
setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package api.player.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
|
||||
public class ModelPlayer extends ModelBiped {
|
||||
|
||||
public ModelPlayer() {
|
||||
this(0.0F);
|
||||
}
|
||||
|
||||
public ModelPlayer(float var1) {
|
||||
this(var1, 0.0F, 64, 32);
|
||||
}
|
||||
|
||||
public ModelPlayer(float var1, float var2, int var3, int var4) {
|
||||
super(var1, var2, var3, var4);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ public class EntityNPC64x64 extends EntityCustomNpc{
|
||||
|
||||
public EntityNPC64x64(World world) {
|
||||
super(world);
|
||||
display.setSkinTexture("customnpcs:textures/entity/humanmale/Steve64.png");
|
||||
display.texture = "customnpcs:textures/entity/humanmale/Steve64.png";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user