mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 01:29:05 +00:00
Fixed Entity Modeling!
This commit is contained in:
1 parent
85307a1646
commit
59263e1ad9
10 files changed
+110
-137
No files matched your search
@@ -201,7 +201,6 @@ public class CustomNpcs {
|
||||
registerNpc(EntityNpcDragon.class, "NpcDragon");
|
||||
registerNpc(EntityNPCEnderman.class, "npcEnderman");
|
||||
registerNpc(EntityNPCGolem.class, "npcGolem");
|
||||
registerNpc(EntityCustomNpc64.class, "CustomNpc64");
|
||||
registerNpc(EntityCustomNpc.class, "CustomNpc");
|
||||
|
||||
|
||||
|
||||
@@ -181,10 +181,7 @@ public class ClientProxy extends CommonProxy {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNpcSlime.class, new RenderNpcSlime(new ModelNpcSlime(16), new ModelNpcSlime(0), 0.25F));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityProjectile.class, new RenderProjectile());
|
||||
|
||||
// Changes Made Here:
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityCustomNpc.class, new RenderCustomNpc());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityCustomNpc64.class, new RenderCustomNpc(false)); // False for Steve
|
||||
// RenderingRegistry.registerEntityRenderingHandler(EntityNPCAlex.class, new RenderCustomNpc(true)); // False for Steve
|
||||
|
||||
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityNPCGolem.class, new RenderNPCHumanMale(
|
||||
|
||||
@@ -32,7 +32,6 @@ import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.PixelmonHelper;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityFakeLiving;
|
||||
import noppes.npcs.entity.EntityCustomNpc64;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class GuiCreationScreen extends GuiModelInterface implements ICustomScrollListener{
|
||||
@@ -63,7 +62,6 @@ public class GuiCreationScreen extends GuiModelInterface implements ICustomScrol
|
||||
} catch (NoSuchMethodException e) {
|
||||
}
|
||||
}
|
||||
data.put("CustomNPC64", EntityCustomNpc64.class);
|
||||
list = new ArrayList<String>(data.keySet());
|
||||
Collections.sort(list,String.CASE_INSENSITIVE_ORDER);
|
||||
}
|
||||
|
||||
@@ -118,10 +118,11 @@ public class ModelMPM extends ModelNPCMale{
|
||||
}
|
||||
}
|
||||
|
||||
// Updated False = 64x32 Skin
|
||||
// Steve 64x64 and Alex 64x64
|
||||
public ModelMPM(float par1, boolean arms) {
|
||||
public ModelMPM(float par1, boolean updated, boolean arms) {
|
||||
|
||||
super(par1, true);
|
||||
super(par1, updated, arms);
|
||||
isArmor = par1 > 0;
|
||||
float par2 = 0;
|
||||
|
||||
@@ -143,23 +144,58 @@ public class ModelMPM extends ModelNPCMale{
|
||||
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));
|
||||
this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, par1);
|
||||
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + par2, 0.0F);
|
||||
if(updated){
|
||||
if (arms){
|
||||
// Alex Version
|
||||
this.bipedRightArm = (new ModelScaleRenderer(this, 40, 16));
|
||||
this.bipedRightArm.addBox(-2.0F, -2.0F, -2.0F, 3, 12, 4, par1);
|
||||
this.bipedRightArm.setRotationPoint(-5.0F, 2.5F + par2, 0.0F);
|
||||
|
||||
// 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.bipedLeftArm = new ModelScaleRenderer(this, 32, 48);
|
||||
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, par1);
|
||||
this.bipedLeftArm.setRotationPoint(5.0F, 2.5F + par2, 0.0F);
|
||||
}
|
||||
else{
|
||||
// Steve Version
|
||||
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);
|
||||
|
||||
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));
|
||||
this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1);
|
||||
this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + par2, 0.0F);
|
||||
|
||||
// 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);
|
||||
}
|
||||
else{
|
||||
|
||||
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);
|
||||
this.bipedLeftArm = new ModelScaleRenderer(this, 40, 16);
|
||||
this.bipedLeftArm.mirror = true;
|
||||
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);
|
||||
this.bipedRightLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1);
|
||||
this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F + par2, 0.0F);
|
||||
this.bipedLeftLeg = new ModelScaleRenderer(this, 0, 16);
|
||||
this.bipedLeftLeg.mirror = true;
|
||||
this.bipedLeftLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, par1);
|
||||
this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F + par2, 0.0F);
|
||||
|
||||
}
|
||||
|
||||
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 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);
|
||||
|
||||
headwear = new ModelHeadwear(this, arms);
|
||||
legs = new ModelLegs(this, (ModelScaleRenderer)bipedRightLeg, (ModelScaleRenderer)bipedLeftLeg);
|
||||
@@ -179,6 +215,7 @@ public class ModelMPM extends ModelNPCMale{
|
||||
this.bipedBody.addChild(skirt = new ModelSkirt(this));
|
||||
this.bipedBody.addChild(fin = new ModelFin(this));
|
||||
|
||||
// NEED TO FIX
|
||||
this.bipedLeftArm.addChild(clawsL = new ModelClaws(this, false));
|
||||
this.bipedRightArm.addChild(clawsR = new ModelClaws(this, true));
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.client.model.util.ModelScaleRenderer;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -21,19 +22,16 @@ public class ModelNPCMale extends ModelBiped
|
||||
public float animationTick;
|
||||
public float dancingTicks;
|
||||
|
||||
public float randomFloat;
|
||||
|
||||
public ModelNPCMale(float f)
|
||||
{
|
||||
init(f, 0.0F);
|
||||
randomFloat = f;
|
||||
}
|
||||
|
||||
public ModelNPCMale(float f, boolean newSteve)
|
||||
public ModelNPCMale(float f, boolean updated, boolean arms)
|
||||
{
|
||||
super(f, 0.0F, 64, 64);
|
||||
init(f, 0.0F, true);
|
||||
randomFloat = f;
|
||||
init(f, 0.0F, updated, arms);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,7 +42,7 @@ public class ModelNPCMale extends ModelBiped
|
||||
|
||||
|
||||
// 64x64 Skin
|
||||
public void init(float f, float f1, boolean NewSteve)
|
||||
public void init(float f, float f1, boolean updated, boolean arms)
|
||||
{
|
||||
|
||||
heldItemLeft = 0;
|
||||
@@ -74,29 +72,56 @@ public class ModelNPCMale extends ModelBiped
|
||||
bipedBody.addBox(-4F, 0.0F, -2F, 8, 12, 4, f);
|
||||
bipedBody.setRotationPoint(0.0F, 0.0F + f1, 0.0F);
|
||||
|
||||
if(updated){
|
||||
if (arms){
|
||||
// Alex Version
|
||||
bipedRightArm = (new ModelScaleRenderer(this, 40, 16));
|
||||
bipedRightArm.addBox(-2.0F, -2.0F, -2.0F, 3, 12, 4, f);
|
||||
bipedRightArm.setRotationPoint(-5.0F, 2.5F + 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);
|
||||
bipedLeftArm = new ModelScaleRenderer(this, 32, 48);
|
||||
bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 3, 12, 4, f);
|
||||
bipedLeftArm.setRotationPoint(5.0F, 2.5F + f1, 0.0F);
|
||||
}
|
||||
else{
|
||||
// Steve Version
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
// 64x64 Leg Version
|
||||
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);
|
||||
}
|
||||
else{
|
||||
bipedRightArm = new ModelRenderer(this, 40, 16);
|
||||
bipedRightArm.addBox(-3F, -2F, -2F, 4, 12, 4, f);
|
||||
bipedRightArm.setRotationPoint(-5F, 2.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);
|
||||
bipedLeftArm = new ModelRenderer(this, 40, 16);
|
||||
bipedLeftArm.mirror = true;
|
||||
bipedLeftArm.addBox(-1F, -2F, -2F, 4, 12, 4, f);
|
||||
bipedLeftArm.setRotationPoint(5F, 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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -11,36 +11,20 @@ public class ImageBufferDownloadAlt extends ImageBufferDownload {
|
||||
private int imageData[];
|
||||
private int imageWidth;
|
||||
private int imageHeight;
|
||||
private boolean NPC64;
|
||||
|
||||
public ImageBufferDownloadAlt() {
|
||||
NPC64 = false;
|
||||
}
|
||||
|
||||
public ImageBufferDownloadAlt(boolean value) {
|
||||
NPC64 = value;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BufferedImage parseUserSkin(BufferedImage bufferedimage) {
|
||||
|
||||
imageWidth = bufferedimage.getWidth(null);
|
||||
imageHeight = bufferedimage.getHeight(null);
|
||||
// } else {
|
||||
// imageHeight = imageWidth / 2;
|
||||
// }
|
||||
|
||||
BufferedImage bufferedimage1 = new BufferedImage(imageWidth, imageHeight, 2);
|
||||
BufferedImage bufferedimage1 = new BufferedImage(imageWidth, imageWidth, 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 / 4);
|
||||
// } else {
|
||||
// setAreaTransparent(imageWidth / 2, 0, imageWidth, imageHeight / 2);
|
||||
// }
|
||||
|
||||
setAreaTransparent(imageWidth / 2, 0, imageWidth, imageHeight / 4);
|
||||
|
||||
return bufferedimage1;
|
||||
}
|
||||
|
||||
@@ -29,14 +29,7 @@ public class RenderCustomNpc extends RenderNPCHumanMale{
|
||||
|
||||
// Default Renderer
|
||||
public RenderCustomNpc() {
|
||||
super(new ModelMPM(0), new ModelMPM(1), new ModelMPM(0.5f));
|
||||
}
|
||||
|
||||
// 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));
|
||||
super(new ModelMPM(0, false, false), new ModelMPM(1,false, false), new ModelMPM(0.5f, false, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,6 +55,9 @@ public class RenderNPCHumanMale extends RenderNPCInterface
|
||||
protected ModelNPCMale modelArmorChestplate;
|
||||
protected ModelNPCMale modelArmor;
|
||||
|
||||
protected final ModelMPM steve = new ModelMPM(0, true, false);
|
||||
protected final ModelMPM alex = new ModelMPM(0, true, true);
|
||||
|
||||
public RenderNPCHumanMale(ModelNPCMale mainmodel, ModelNPCMale armorChest, ModelNPCMale armor)
|
||||
{
|
||||
super(mainmodel, 0.5F);
|
||||
@@ -138,10 +141,10 @@ public class RenderNPCHumanMale extends RenderNPCInterface
|
||||
this.mainModel = originalModel;
|
||||
}
|
||||
else if(modelVal == 1){
|
||||
this.mainModel = new ModelMPM(0, false);
|
||||
this.mainModel = steve;
|
||||
}
|
||||
else{
|
||||
this.mainModel = new ModelMPM(0, true);
|
||||
this.mainModel = alex;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -432,49 +435,6 @@ public class RenderNPCHumanMale extends RenderNPCInterface
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getEntityTexture(Entity entity) {
|
||||
EntityNPCInterface npc = (EntityNPCInterface) entity;
|
||||
|
||||
if (npc.textureLocation == null) {
|
||||
if (npc.display.skinType == 0)
|
||||
npc.textureLocation = new ResourceLocation(npc.display.texture);
|
||||
else if (LastTextureTick < 5) { //fixes request flood somewhat
|
||||
return AbstractClientPlayer.locationStevePng;
|
||||
} else if (npc.display.skinType == 1 && npc.display.playerProfile != null) {
|
||||
Minecraft minecraft = Minecraft.getMinecraft();
|
||||
Map map = minecraft.func_152342_ad().func_152788_a(npc.display.playerProfile);
|
||||
if (map.containsKey(MinecraftProfileTexture.Type.SKIN)) {
|
||||
npc.textureLocation = minecraft.func_152342_ad().func_152792_a((MinecraftProfileTexture) map.get(MinecraftProfileTexture.Type.SKIN), MinecraftProfileTexture.Type.SKIN);
|
||||
}
|
||||
LastTextureTick = 0;
|
||||
} else if (npc.display.skinType == 2) {
|
||||
try {
|
||||
MessageDigest digest = MessageDigest.getInstance("MD5");
|
||||
byte[] hash = digest.digest(npc.display.url.getBytes("UTF-8"));
|
||||
StringBuilder sb = new StringBuilder(2 * hash.length);
|
||||
for (byte b : hash) {
|
||||
sb.append(String.format("%02x", b & 0xff));
|
||||
}
|
||||
npc.textureLocation = new ResourceLocation("skins/" + sb.toString());
|
||||
loadSkin(null, npc.textureLocation, npc.display.url, false);
|
||||
LastTextureTick = 0;
|
||||
} catch (Exception ex) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if(npc.textureLocation == null)
|
||||
return AbstractClientPlayer.locationStevePng;
|
||||
return npc.textureLocation;
|
||||
}
|
||||
|
||||
private void loadSkin(File file, ResourceLocation resource, String par1Str, boolean value){
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||
ITextureObject object = new ImageDownloadAlt(file, par1Str, SkinManager.field_152793_a, new ImageBufferDownloadAlt(value));
|
||||
texturemanager.loadTexture(resource, object);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderEquippedItems(EntityLivingBase entityliving, float f){
|
||||
renderSpecials((EntityNPCInterface)entityliving, f);
|
||||
|
||||
@@ -24,7 +24,6 @@ import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.constants.EnumStandingType;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityCustomNpc64;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package noppes.npcs.entity;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.client.EntityUtil;
|
||||
|
||||
public class EntityCustomNpc64 extends EntityCustomNpc{
|
||||
|
||||
public EntityCustomNpc64(World world) {
|
||||
super(world);
|
||||
display.texture = "customnpcs:textures/entity/humanmale/Steve64.png";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user