mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 17:19:05 +00:00
Full Imports and Code Format Optimization
This commit is contained in:
1 parent
250edf099c
commit
6815f579a7
1192 files changed
+60344
-62167
No files matched your search
@@ -12,8 +12,7 @@ import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ModelNPCMale extends ModelBiped
|
||||
{
|
||||
public class ModelNPCMale extends ModelBiped {
|
||||
public boolean isDancing;
|
||||
public boolean isSleeping;
|
||||
|
||||
@@ -22,27 +21,24 @@ public class ModelNPCMale extends ModelBiped
|
||||
|
||||
public float invisible;
|
||||
|
||||
public ModelNPCMale(float f)
|
||||
{
|
||||
public ModelNPCMale(float f) {
|
||||
init(f, 0.0F);
|
||||
}
|
||||
|
||||
public ModelNPCMale(float f, boolean alex)
|
||||
{
|
||||
public ModelNPCMale(float f, boolean alex) {
|
||||
super(f, 0.0F, 64, 64);
|
||||
init(f, 0.0F, alex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLivingAnimations(EntityLivingBase par1EntityLiving, float f6, float f5, float par9){
|
||||
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 arms)
|
||||
{
|
||||
public void init(float f, float f1, boolean arms) {
|
||||
|
||||
heldItemLeft = 0;
|
||||
heldItemRight = 0;
|
||||
@@ -70,7 +66,7 @@ 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 (arms){
|
||||
if (arms) {
|
||||
// Alex Version
|
||||
bipedRightArm = (new ModelScaleRenderer(this, 40, 16));
|
||||
bipedRightArm.addBox(-2.0F, -2.0F, -2.0F, 3, 12, 4, f);
|
||||
@@ -79,8 +75,7 @@ public class ModelNPCMale extends ModelBiped
|
||||
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{
|
||||
} else {
|
||||
// Steve Version
|
||||
bipedRightArm = new ModelRenderer(this, 40, 16);
|
||||
bipedRightArm.addBox(-3F, -2F, -2F, 4, 12, 4, f);
|
||||
@@ -102,8 +97,7 @@ public class ModelNPCMale extends ModelBiped
|
||||
}
|
||||
|
||||
// 64x32
|
||||
public void init(float f, float f1)
|
||||
{
|
||||
public void init(float f, float f1) {
|
||||
heldItemLeft = 0;
|
||||
heldItemRight = 0;
|
||||
isSneak = false;
|
||||
@@ -144,13 +138,11 @@ public class ModelNPCMale extends ModelBiped
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7){
|
||||
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);
|
||||
|
||||
if(!isDancing){
|
||||
if (!isDancing) {
|
||||
bipedHead.render(par7);
|
||||
bipedBody.render(par7);
|
||||
bipedRightArm.render(par7);
|
||||
@@ -158,117 +150,113 @@ public class ModelNPCMale extends ModelBiped
|
||||
bipedRightLeg.render(par7);
|
||||
bipedLeftLeg.render(par7);
|
||||
bipedHeadwear.render(par7);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
renderHead(par1Entity, par7);
|
||||
renderArms(par1Entity, par7);
|
||||
renderBody(par1Entity, par7);
|
||||
renderLegs(par1Entity, par7);
|
||||
}
|
||||
}
|
||||
public void renderHead(Entity entityliving,float par7){
|
||||
if(isDancing){
|
||||
|
||||
public void renderHead(Entity entityliving, float par7) {
|
||||
if (isDancing) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)Math.sin(dancingTicks) * 0.075F, (float)Math.abs(Math.cos(dancingTicks)) * 0.125F - 0.02F, (float)(-Math.abs(Math.cos(dancingTicks))) * 0.075F);
|
||||
GL11.glTranslatef((float) Math.sin(dancingTicks) * 0.075F, (float) Math.abs(Math.cos(dancingTicks)) * 0.125F - 0.02F, (float) (-Math.abs(Math.cos(dancingTicks))) * 0.075F);
|
||||
bipedHead.render(par7);
|
||||
bipedHeadwear.render(par7);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
bipedHead.render(par7);
|
||||
bipedHeadwear.render(par7);
|
||||
}
|
||||
}
|
||||
public void renderLeftArm(Entity entityliving,float par7){
|
||||
if(isDancing){
|
||||
|
||||
public void renderLeftArm(Entity entityliving, float par7) {
|
||||
if (isDancing) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)Math.sin(dancingTicks) * 0.025F, (float)Math.abs(Math.cos(dancingTicks)) * 0.125F - 0.02F, 0.0F);
|
||||
GL11.glTranslatef((float) Math.sin(dancingTicks) * 0.025F, (float) Math.abs(Math.cos(dancingTicks)) * 0.125F - 0.02F, 0.0F);
|
||||
bipedLeftArm.render(par7);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
bipedLeftArm.render(par7);
|
||||
}
|
||||
}
|
||||
public void renderArms(Entity entity,float par7){
|
||||
renderLeftArm(entity,par7);
|
||||
renderRightArm(entity,par7);
|
||||
|
||||
public void renderArms(Entity entity, float par7) {
|
||||
renderLeftArm(entity, par7);
|
||||
renderRightArm(entity, par7);
|
||||
}
|
||||
public void renderRightArm(Entity entityliving,float par7){
|
||||
if(isDancing){
|
||||
|
||||
public void renderRightArm(Entity entityliving, float par7) {
|
||||
if (isDancing) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)Math.sin(dancingTicks) * 0.025F, (float)Math.abs(Math.cos(dancingTicks)) * 0.125F - 0.02F, 0.0F);
|
||||
GL11.glTranslatef((float) Math.sin(dancingTicks) * 0.025F, (float) Math.abs(Math.cos(dancingTicks)) * 0.125F - 0.02F, 0.0F);
|
||||
bipedRightArm.render(par7);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
bipedRightArm.render(par7);
|
||||
}
|
||||
}
|
||||
public void renderBody(Entity entityliving,float par7){
|
||||
if(isDancing){
|
||||
|
||||
public void renderBody(Entity entityliving, float par7) {
|
||||
if (isDancing) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float)Math.sin(dancingTicks) * 0.015F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef((float) Math.sin(dancingTicks) * 0.015F, 0.0F, 0.0F);
|
||||
bipedBody.render(par7);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
bipedBody.render(par7);
|
||||
}
|
||||
}
|
||||
public void renderLegs(Entity entityliving,float par7){
|
||||
|
||||
public void renderLegs(Entity entityliving, float par7) {
|
||||
bipedRightLeg.render(par7);
|
||||
bipedLeftLeg.render(par7);
|
||||
}
|
||||
|
||||
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity)
|
||||
{
|
||||
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity) {
|
||||
EntityNPCInterface npc = (EntityNPCInterface) entity;
|
||||
isRiding = npc.isRiding();
|
||||
|
||||
|
||||
if(isSneak && (npc.currentAnimation == EnumAnimation.CRAWLING || npc.currentAnimation == EnumAnimation.LYING))
|
||||
if (isSneak && (npc.currentAnimation == EnumAnimation.CRAWLING || npc.currentAnimation == EnumAnimation.LYING))
|
||||
isSneak = false;
|
||||
bipedHead.rotateAngleY = par4 / (180F / (float)Math.PI);
|
||||
bipedHead.rotateAngleX = par5 / (180F / (float)Math.PI);
|
||||
bipedHead.rotateAngleY = par4 / (180F / (float) Math.PI);
|
||||
bipedHead.rotateAngleX = par5 / (180F / (float) Math.PI);
|
||||
bipedHeadwear.rotateAngleY = bipedHead.rotateAngleY;
|
||||
bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX;
|
||||
bipedRightArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 2.0F * par2 * 0.5F;
|
||||
bipedRightArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 2.0F * par2 * 0.5F;
|
||||
bipedLeftArm.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 2.0F * par2 * 0.5F;
|
||||
bipedRightArm.rotateAngleZ = 0.0F;
|
||||
bipedLeftArm.rotateAngleZ = 0.0F;
|
||||
bipedRightLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F) * 1.4F * par2;
|
||||
bipedLeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float)Math.PI) * 1.4F * par2;
|
||||
bipedLeftLeg.rotateAngleX = MathHelper.cos(par1 * 0.6662F + (float) Math.PI) * 1.4F * par2;
|
||||
bipedRightLeg.rotateAngleY = 0.0F;
|
||||
bipedLeftLeg.rotateAngleY = 0.0F;
|
||||
|
||||
if (isRiding)
|
||||
{
|
||||
bipedRightArm.rotateAngleX += -((float)Math.PI / 5F);
|
||||
bipedLeftArm.rotateAngleX += -((float)Math.PI / 5F);
|
||||
bipedRightLeg.rotateAngleX = -((float)Math.PI * 2F / 5F);
|
||||
bipedLeftLeg.rotateAngleX = -((float)Math.PI * 2F / 5F);
|
||||
bipedRightLeg.rotateAngleY = ((float)Math.PI / 10F);
|
||||
bipedLeftLeg.rotateAngleY = -((float)Math.PI / 10F);
|
||||
if (isRiding) {
|
||||
bipedRightArm.rotateAngleX += -((float) Math.PI / 5F);
|
||||
bipedLeftArm.rotateAngleX += -((float) Math.PI / 5F);
|
||||
bipedRightLeg.rotateAngleX = -((float) Math.PI * 2F / 5F);
|
||||
bipedLeftLeg.rotateAngleX = -((float) Math.PI * 2F / 5F);
|
||||
bipedRightLeg.rotateAngleY = ((float) Math.PI / 10F);
|
||||
bipedLeftLeg.rotateAngleY = -((float) Math.PI / 10F);
|
||||
}
|
||||
|
||||
if (heldItemLeft != 0)
|
||||
{
|
||||
bipedLeftArm.rotateAngleX = bipedLeftArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)heldItemLeft;
|
||||
if (heldItemLeft != 0) {
|
||||
bipedLeftArm.rotateAngleX = bipedLeftArm.rotateAngleX * 0.5F - ((float) Math.PI / 10F) * (float) heldItemLeft;
|
||||
}
|
||||
|
||||
if (heldItemRight != 0)
|
||||
{
|
||||
bipedRightArm.rotateAngleX = bipedRightArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)heldItemRight;
|
||||
if (heldItemRight != 0) {
|
||||
bipedRightArm.rotateAngleX = bipedRightArm.rotateAngleX * 0.5F - ((float) Math.PI / 10F) * (float) heldItemRight;
|
||||
}
|
||||
|
||||
bipedRightArm.rotateAngleY = 0.0F;
|
||||
bipedLeftArm.rotateAngleY = 0.0F;
|
||||
|
||||
if (onGround > -9990F)
|
||||
{
|
||||
if (onGround > -9990F) {
|
||||
float f = onGround;
|
||||
bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f) * (float)Math.PI * 2.0F) * 0.2F;
|
||||
bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f) * (float) Math.PI * 2.0F) * 0.2F;
|
||||
bipedRightArm.rotationPointZ = MathHelper.sin(bipedBody.rotateAngleY) * 5F;
|
||||
bipedRightArm.rotationPointX = -MathHelper.cos(bipedBody.rotateAngleY) * 5F;
|
||||
bipedLeftArm.rotationPointZ = -MathHelper.sin(bipedBody.rotateAngleY) * 5F;
|
||||
@@ -280,15 +268,14 @@ public class ModelNPCMale extends ModelBiped
|
||||
f *= f;
|
||||
f *= f;
|
||||
f = 1.0F - f;
|
||||
float f2 = MathHelper.sin(f * (float)Math.PI);
|
||||
float f4 = MathHelper.sin(onGround * (float)Math.PI) * -(bipedHead.rotateAngleX - 0.7F) * 0.75F;
|
||||
bipedRightArm.rotateAngleX -= (double)f2 * 1.2D + (double)f4;
|
||||
float f2 = MathHelper.sin(f * (float) Math.PI);
|
||||
float f4 = MathHelper.sin(onGround * (float) Math.PI) * -(bipedHead.rotateAngleX - 0.7F) * 0.75F;
|
||||
bipedRightArm.rotateAngleX -= (double) f2 * 1.2D + (double) f4;
|
||||
bipedRightArm.rotateAngleY += bipedBody.rotateAngleY * 2.0F;
|
||||
bipedRightArm.rotateAngleZ = MathHelper.sin(onGround * (float)Math.PI) * -0.4F;
|
||||
bipedRightArm.rotateAngleZ = MathHelper.sin(onGround * (float) Math.PI) * -0.4F;
|
||||
}
|
||||
|
||||
if (isSneak)
|
||||
{
|
||||
if (isSneak) {
|
||||
bipedBody.rotateAngleX = 0.5F;
|
||||
bipedRightLeg.rotateAngleX -= 0.0F;
|
||||
bipedLeftLeg.rotateAngleX -= 0.0F;
|
||||
@@ -299,9 +286,7 @@ public class ModelNPCMale extends ModelBiped
|
||||
bipedRightLeg.rotationPointY = 9F;
|
||||
bipedLeftLeg.rotationPointY = 9F;
|
||||
bipedHead.rotationPointY = 1.0F;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
bipedBody.rotateAngleX = 0.0F;
|
||||
bipedRightLeg.rotationPointZ = 0.0F;
|
||||
bipedLeftLeg.rotationPointZ = 0.0F;
|
||||
@@ -315,16 +300,15 @@ public class ModelNPCMale extends ModelBiped
|
||||
bipedRightArm.rotateAngleX += MathHelper.sin(par3 * 0.067F) * 0.05F;
|
||||
bipedLeftArm.rotateAngleX -= MathHelper.sin(par3 * 0.067F) * 0.05F;
|
||||
|
||||
if (aimedBow)
|
||||
{
|
||||
if (aimedBow) {
|
||||
float f1 = 0.0F;
|
||||
float f3 = 0.0F;
|
||||
bipedRightArm.rotateAngleZ = 0.0F;
|
||||
bipedLeftArm.rotateAngleZ = 0.0F;
|
||||
bipedRightArm.rotateAngleY = -(0.1F - f1 * 0.6F) + bipedHead.rotateAngleY;
|
||||
bipedLeftArm.rotateAngleY = (0.1F - f1 * 0.6F) + bipedHead.rotateAngleY + 0.4F;
|
||||
bipedRightArm.rotateAngleX = -((float)Math.PI / 2F) + bipedHead.rotateAngleX;
|
||||
bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F) + bipedHead.rotateAngleX;
|
||||
bipedRightArm.rotateAngleX = -((float) Math.PI / 2F) + bipedHead.rotateAngleX;
|
||||
bipedLeftArm.rotateAngleX = -((float) Math.PI / 2F) + bipedHead.rotateAngleX;
|
||||
bipedRightArm.rotateAngleX -= f1 * 1.2F - f3 * 0.4F;
|
||||
bipedLeftArm.rotateAngleX -= f1 * 1.2F - f3 * 0.4F;
|
||||
bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F;
|
||||
@@ -334,8 +318,7 @@ public class ModelNPCMale extends ModelBiped
|
||||
}
|
||||
}
|
||||
|
||||
public void renderEars(float f)
|
||||
{
|
||||
public void renderEars(float f) {
|
||||
bipedEars.rotateAngleY = bipedHead.rotateAngleY;
|
||||
bipedEars.rotateAngleX = bipedHead.rotateAngleX;
|
||||
bipedEars.rotationPointX = 0.0F;
|
||||
@@ -343,21 +326,19 @@ public class ModelNPCMale extends ModelBiped
|
||||
bipedEars.render(f);
|
||||
}
|
||||
|
||||
public void setRotation(ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
public void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void renderCloak(float f)
|
||||
{
|
||||
public void renderCloak(float f) {
|
||||
bipedCloak.render(f);
|
||||
}
|
||||
|
||||
public boolean isSleeping(Entity entity) {
|
||||
if(entity instanceof EntityPlayer && ((EntityPlayer)entity).isPlayerSleeping())
|
||||
if (entity instanceof EntityPlayer && ((EntityPlayer) entity).isPlayerSleeping())
|
||||
return true;
|
||||
return ((EntityNPCInterface)entity).currentAnimation == EnumAnimation.LYING;
|
||||
return ((EntityNPCInterface) entity).currentAnimation == EnumAnimation.LYING;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user