diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiModelLegs.java b/src/main/java/noppes/npcs/client/gui/model/GuiModelLegs.java index d38afc7f1..960b23480 100644 --- a/src/main/java/noppes/npcs/client/gui/model/GuiModelLegs.java +++ b/src/main/java/noppes/npcs/client/gui/model/GuiModelLegs.java @@ -2,6 +2,7 @@ package noppes.npcs.client.gui.model; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; +import noppes.npcs.client.gui.util.GuiButtonBiDirectional; import noppes.npcs.client.gui.util.GuiModelInterface; import noppes.npcs.client.gui.util.GuiNpcButton; import noppes.npcs.client.gui.util.GuiNpcLabel; @@ -15,7 +16,7 @@ public class GuiModelLegs extends GuiModelInterface{ private final String[] arrLegwear = new String[]{"gui.no","Both","Left","Right"}; private final String[] arrSolidLegwear = new String[]{"gui.no","Both","Left","Right"}; private final String[] arrLegs = new String[]{"gui.no","Player","Player Naga","Spider","Horse","Naga", "Mermaid", "Mermaid 2", "Digitigrade"}; - private final String[] arrTail = new String[]{"gui.no","Player", "Player Dragon","Cat","Wolf","Horse","Dragon", "Squirrel", "Fin", "Rodent", "Feather"}; + private final String[] arrTail = new String[]{"gui.no","Player", "Player Dragon","Cat","Wolf","Horse","Dragon", "Squirrel", "Fin", "Rodent", "Feather", "Fox", "Monkey"}; public GuiModelLegs(GuiScreen parent, EntityCustomNpc npc){ super(npc); this.parent = parent; @@ -48,6 +49,11 @@ public class GuiModelLegs extends GuiModelInterface{ addLabel(new GuiNpcLabel(2, "Tail", guiLeft, y + 5, 0xFFFFFF)); if(tail != null) addButton(new GuiNpcButton(12, guiLeft + 122, y, 40, 20, tail.getColor())); + if(tail != null && tail.type == 8){ + y += 22; + this.addLabel(new GuiNpcLabel(22, "Pattern", guiLeft, y + 5, 0xFFFFFF)); + this.addButton(new GuiButtonBiDirectional(22, guiLeft + 50, y, 100, 20, new String[]{"Normal", "Wrapped", "Large"}, tail.pattern)); + } } private int getLegIndex(ModelPartData data) { @@ -83,91 +89,105 @@ public class GuiModelLegs extends GuiModelInterface{ return 9; if(data.type == 6) return 10; + if(data.type == 7) + return 11; + if(data.type == 8) + return 12; - return 0; + return 0; } @Override protected void actionPerformed(GuiButton btn) { - super.actionPerformed(btn); - GuiNpcButton button = (GuiNpcButton) btn; + super.actionPerformed(btn); + GuiNpcButton button = (GuiNpcButton) btn; - if(button.id == 8){ - playerdata.legwear = (byte) button.getValue(); - } - if(button.id == 9){ - playerdata.solidLegwear = (byte) button.getValue(); - } - if(button.id == 30){ - playerdata.hideLegs = (byte) button.getValue(); - } - if(button.id == 1){ - ModelPartData data = playerdata.legParts; - int value = button.getValue() - 1; - if(value < 1) - data.color = 0xFFFFFF; - if(value < 2){ - data.setTexture("", value); - } - if(value == 2) - data.setTexture("legs/spider1", 2); - if(value == 3) - data.setTexture("legs/horse1", 3); - if(value == 4) - if (npc.display.modelType == 1 || npc.display.modelType == 2){ - data.setTexture("legs/naga2", 1); - } - else{ - data.setTexture("legs/naga1", 1); - } - if(value == 5) - data.setTexture("legs/mermaid1", 4); - if(value == 6) - data.setTexture("legs/mermaid1", 6); - if(value == 7) - data.setTexture("", 5); + if(button.id == 8){ + playerdata.legwear = (byte) button.getValue(); + } + if(button.id == 9){ + playerdata.solidLegwear = (byte) button.getValue(); + } + if(button.id == 30){ + playerdata.hideLegs = (byte) button.getValue(); + } + if(button.id == 1){ + ModelPartData data = playerdata.legParts; + int value = button.getValue() - 1; + if(value < 1) + data.color = 0xFFFFFF; + if(value < 2){ + data.setTexture("", value); + } + if(value == 2) + data.setTexture("legs/spider1", 2); + if(value == 3) + data.setTexture("legs/horse1", 3); + if(value == 4) + if (npc.display.modelType == 1 || npc.display.modelType == 2){ + data.setTexture("legs/naga2", 1); + } + else{ + data.setTexture("legs/naga1", 1); + } + if(value == 5) + data.setTexture("legs/mermaid1", 4); + if(value == 6) + data.setTexture("legs/mermaid1", 6); + if(value == 7) + data.setTexture("", 5); - initGui(); + initGui(); - } + } - if(button.id == 2){ - int value = button.getValue(); - if(value == 0) - playerdata.removePart("tail"); - else{ - ModelPartData data = playerdata.getOrCreatePart("tail"); - if(value == 1) - data.setTexture("", 0); - if(value == 2) - data.setTexture("", 1); - if(value == 3) - data.setTexture("tail/tail1", 0); - if(value == 4) - data.setTexture("tail/tail2", 0); - if(value == 5) - data.setTexture("tail/horse1", 2); - if(value == 6) - data.setTexture("tail/dragon1", 1); - if(value == 7) - data.setTexture("tail/squirrel1", 3); - if(value == 8) - data.setTexture("tail/fin1", 4); - if(value == 9) - data.setTexture("tail/rodent1", 5); - if(value == 10) - data.setTexture("tail/feather1", 6); + if(button.id == 2){ + int value = button.getValue(); + if(value == 0) + playerdata.removePart("tail"); + else{ + ModelPartData data = playerdata.getOrCreatePart("tail"); + if(value == 1){} + data.setTexture("", 0); + if(value == 2) + data.setTexture("", 1); + if(value == 3) + data.setTexture("tail/tail1", 0); + if(value == 4) + data.setTexture("tail/tail2", 0); + if(value == 5) + data.setTexture("tail/horse1", 2); + if(value == 6) + data.setTexture("tail/dragon1", 1); + if(value == 7) + data.setTexture("tail/squirrel1", 3); + if(value == 8) + data.setTexture("tail/fin1", 4); + if(value == 9) + data.setTexture("tail/rodent1", 5); + if(value == 10) + data.setTexture("tail/feather1", 6); + if(value == 11) + data.setTexture("tail/fox1", 7); + if(value == 12) + data.setTexture("tail/monkey1", 8); - } - initGui(); - } - if(button.id == 11){ - this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.legParts, npc)); - } + data.pattern = 0; + } + initGui(); + } + if(button.id == 22){ + int value = button.getValue(); + ModelPartData data = playerdata.getOrCreatePart("tail"); + data.pattern = (byte) value; + } + if(button.id == 11){ + this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.legParts, npc)); + } - if(button.id == 12){ - this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("tail"), npc)); - } + if(button.id == 12){ + this.mc.displayGuiScreen(new GuiModelColor(this, playerdata.getPartData("tail"), npc)); + } } @Override diff --git a/src/main/java/noppes/npcs/client/model/part/ModelTail.java b/src/main/java/noppes/npcs/client/model/part/ModelTail.java index d766a9fee..b18e985e3 100644 --- a/src/main/java/noppes/npcs/client/model/part/ModelTail.java +++ b/src/main/java/noppes/npcs/client/model/part/ModelTail.java @@ -26,6 +26,8 @@ public class ModelTail extends ModelScaleRenderer { private ModelRenderer fin; private ModelRenderer rodent; private ModelRenderer feather; + private ModelCanineTail fox; + private ModelMonkeyTail monkey; private int color = 0xFFFFFF; @@ -65,15 +67,13 @@ public class ModelTail extends ModelScaleRenderer { horse.addChild(tailTip); horse.rotateAngleX = 0.5f; - this.addChild(dragon = new ModelDragonTail(base)); - this.addChild(squirrel = new ModelSquirrelTail(base)); - this.addChild(fin = new ModelTailFin(base)); this.addChild(rodent = new ModelRodentTail(base)); - this.addChild(feather = new ModelFeatherTail(base)); + this.addChild(fox = new ModelCanineTail(base)); + this.addChild(monkey = new ModelMonkeyTail(base)); } public void setData(EntityCustomNpc entity) { @@ -85,30 +85,54 @@ public class ModelTail extends ModelScaleRenderer { float par4, float par5, float par6, Entity entity) { if(this.entity==null) return; - rotateAngleY = MathHelper.cos(par1 * 0.6662F) * 0.3f * par2; - rotateAngleX = MathHelper.sin(par3 * 0.067F) * 0.05F; + float rotateAngleY = MathHelper.cos(par1 * 0.6662F) * 0.3f * par2; + float rotateAngleX = MathHelper.sin(par3 * 0.067F) * 0.05F; + rotationPointY = 11; if(this.entity.modelData.legParts.type == 2){ rotationPointY = 13f; rotationPointZ = 14 * this.entity.modelData.modelScale.legs.scaleZ; if(base.isSleeping(entity) || this.entity.currentAnimation == EnumAnimation.CRAWLING){ rotationPointY = 12 + 16 * this.entity.modelData.modelScale.legs.scaleZ; - rotationPointZ = 1f * this.entity.modelData.modelScale.legs.scaleY; + rotationPointZ = this.entity.modelData.modelScale.legs.scaleY; rotateAngleX = (float) (Math.PI / -4); } } else if(this.entity.modelData.legParts.type == 3){ - rotationPointY = 8.6f; - rotationPointZ = 19 * this.entity.modelData.modelScale.legs.scaleZ; + // rotationPointY = 8.6f; + rotationPointY = 10; + rotationPointZ = 19 * this.entity.modelData.modelScale.legs.scaleZ; } - else{ - rotationPointY = 11; - this.rotationPointZ = -1; + else { + // this.rotationPointZ = -1; + rotationPointZ = -1; + } + ModelPartData partTail = this.entity.modelData.getPartData("tail"); + if(partTail != null){ + if(partTail.type == 2) { + rotateAngleX += 0.5F; + } + if(partTail.type == 0) { + rotateAngleX += 0.87F; + } + if(partTail.type == 7){ + rotationPointY -= 1; + fox.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); + } + if(partTail.type == 8){ + monkey.setRotationAngles(par1, par2, par3, par4, par5, par6, entity); + if(partTail.pattern == 1){ + rotationPointZ += 1; + rotateAngleX = 0; + } + } } this.rotationPointZ += base.bipedRightLeg.rotationPointZ + 0.5f; - } + monkey.rotateAngleX = fox.rotateAngleX = tail.rotateAngleX = feather.rotateAngleX = dragon.rotateAngleX = squirrel.rotateAngleX = horse.rotateAngleX = fin.rotateAngleX = rodent.rotateAngleX = rotateAngleX; + monkey.rotateAngleY = fox.rotateAngleY = tail.rotateAngleY = feather.rotateAngleY = dragon.rotateAngleY = squirrel.rotateAngleY = horse.rotateAngleY = fin.rotateAngleY = rodent.rotateAngleY = rotateAngleY; + } public void setLivingAnimations(ModelPartData data, EntityLivingBase entity, float par2, float par3, float par4) { } @@ -129,6 +153,13 @@ public class ModelTail extends ModelScaleRenderer { fin.isHidden = config.type != 4; rodent.isHidden = config.type != 5; feather.isHidden = config.type != 6; + fox.isHidden = config.type != 7; + + monkey.isHidden = config.type != 8; + monkey.monkey.isHidden = config.pattern != 0; + monkey.monkey_wrapped.isHidden = config.pattern != 1; + monkey.monkey_large.isHidden = config.pattern != 2; + if(!config.playerTexture){ location = config.getResource(); } diff --git a/src/main/java/noppes/npcs/client/model/part/tails/ModelCanineTail.java b/src/main/java/noppes/npcs/client/model/part/tails/ModelCanineTail.java new file mode 100644 index 000000000..16715a9bb --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/tails/ModelCanineTail.java @@ -0,0 +1,67 @@ +package noppes.npcs.client.model.part.tails; + +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; + +public class ModelCanineTail extends ModelRenderer { + ModelRenderer Base_1; + ModelRenderer BaseB_1; + ModelRenderer Mid_1; + ModelRenderer Mid_2; + ModelRenderer MidB_1; + ModelRenderer End_1; + + public ModelCanineTail(ModelBiped base) { + super(base); + + Base_1 = new ModelRenderer(base, 56, 16); + Base_1.addBox(-1F, 0F, -3F, 2, 3, 2); + Base_1.setRotationPoint(0F, 1F, -1.2F); + setRotation(Base_1, -0.4490659F, 3.141593F, 0F); + addChild(Base_1); + + BaseB_1 = new ModelRenderer(base, 56, 16); + BaseB_1.addBox(-0.5F, 0F, -1.5F, 1, 3, 1); + Base_1.addChild(BaseB_1); + + Mid_1 = new ModelRenderer(base, 56, 20); + Mid_1.addBox(-1F, 3F, -2.8F, 2, 2, 2); + setRotation(Mid_1, -0.16F, 0F, 0F); + Base_1.addChild(Mid_1); + + Mid_2 = new ModelRenderer(base, 56, 22); + Mid_2.addBox(-1.5F, 5F, -1.5F, 3, 6, 3); + Mid_2.setRotationPoint(0, 0, -1.5f); + setRotation(Mid_2, -0F, 0F, 0F); + Mid_1.addChild(Mid_2); + + ModelRenderer Mid_2b = new ModelRenderer(base, 56, 22); + Mid_2b.addBox(-1.5F, 5F, -1.5F, 3, 6, 3); + setRotation(Mid_2b, -0F, (float)Math.PI, 0F); + Mid_2.addChild(Mid_2b); + + MidB_1 = new ModelRenderer(base, 56, 20); + MidB_1.addBox(-0.5F, 3F, -1F, 1, 2, 1); + Mid_1.addChild(MidB_1); + + End_1 = new ModelRenderer(base, 56, 29); + End_1.addBox(-1F, 10.7F, -1F, 2, 1, 2); + Mid_2.addChild(End_1); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { + Base_1.rotateAngleX = -0.5490659F - f1 * 0.7f; + + Base_1.rotateAngleY = 3.141593F + rotateAngleY * 0.1f; + Mid_1.rotateAngleY = rotateAngleY * 0.2f; + Mid_2.rotateAngleY = rotateAngleY * 0.2f; + } + +} diff --git a/src/main/java/noppes/npcs/client/model/part/tails/ModelMonkeyTail.java b/src/main/java/noppes/npcs/client/model/part/tails/ModelMonkeyTail.java new file mode 100644 index 000000000..755f609b4 --- /dev/null +++ b/src/main/java/noppes/npcs/client/model/part/tails/ModelMonkeyTail.java @@ -0,0 +1,256 @@ +package noppes.npcs.client.model.part.tails; + +import net.minecraft.client.model.ModelBiped; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; + +public class ModelMonkeyTail extends ModelRenderer { + public boolean isAnimated = true; + + // Monkey Tail + public ModelRenderer monkey; + public ModelRenderer m1; + public ModelRenderer m2; + public ModelRenderer m3; + public ModelRenderer m4; + public ModelRenderer m5; + public ModelRenderer m6; + + // Monkey Tail (Belt) + public ModelRenderer monkey_wrapped; + public ModelRenderer mw1; + public ModelRenderer mw2; + public ModelRenderer mw3; + public ModelRenderer mw4; + + // Monkey Tail (Large) + public ModelRenderer monkey_large; + public ModelRenderer ml1; + public ModelRenderer ml2; + public ModelRenderer ml3; + public ModelRenderer ml4; + public ModelRenderer ml5; + + public ModelMonkeyTail(ModelBiped base) { + super(base); + float heightFactor = -9.0f; + + (this.monkey_large = new ModelRenderer(base, 38, 54)).addBox(-2.0f, -2.0f, 0.0f, 4, 4, 6); + this.setRotation(this.monkey_large, -0.5235988f, 0.0f, 0.0f); + (this.ml1 = new ModelRenderer(base, 38, 54)).addBox(-2.0f, -2.0f, 0.0f, 4, 4, 6); + this.setRotation(this.ml1, 0.5235988f, 8.727E-4f, 0.0f); + (this.ml2 = new ModelRenderer(base, 38, 54)).addBox(-2.0f, -2.0f, 0.0f, 4, 4, 6); + this.setRotation(this.ml2, 0.0f, 0.0f, 0.0f); + (this.ml3 = new ModelRenderer(base, 38, 54)).addBox(-2.0f, -2.0f, 0.0f, 4, 4, 6); + this.setRotation(this.ml3, 0.0f, 0.0f, 0.0f); + (this.ml4 = new ModelRenderer(base, 38, 54)).addBox(-2.0f, -2.0f, 0.0f, 4, 4, 6); + this.setRotation(this.ml4, 0.0f, 0.0f, 0.0f); + (this.ml5 = new ModelRenderer(base, 38, 54)).addBox(-2.0f, -2.0f, 0.0f, 4, 4, 6); + this.setRotation(this.ml5, 0.0f, 0.0f, 0.0f); + + this.monkey_large.rotateAngleX = 0.65f ; + this.monkey_large.rotationPointY = -2.0f ; + this.ml1.rotationPointZ = 5.0f; + this.ml2.rotationPointZ = 5.0f; + this.ml3.rotationPointZ = 5.0f; + this.ml4.rotationPointZ = 5.0f; + this.ml5.rotationPointZ = 5.0f; + + this.ml4.addChild(this.ml5); + this.ml3.addChild(this.ml4); + this.ml2.addChild(this.ml3); + this.ml1.addChild(this.ml2); + this.monkey_large.addChild(this.ml1); + + (this.monkey = new ModelRenderer(base, 0, 0)).addBox(-0.0f, -0.0f, -0.0f, 0, 0, 0, 0.02f); + this.m1 = new ModelRenderer(base, 32, 48).addBox(-1.0f, -1.0f, 0.0f, 2, 2, 4); + this.setRotation(this.m1, -0.5235988f, 0.0f, 0.0f); + this.m2 = new ModelRenderer(base, 32, 48).addBox(-1.0f, -1.0f, 0.0f, 2, 2, 4); + this.setRotation(this.m2, 0.5235988f, 8.727E-4f, 0.0f); + this.m3 = new ModelRenderer(base, 32, 48).addBox(-1.0f, -1.0f, 0.0f, 2, 2, 4); + this.setRotation(this.m3, 0.0f, 0.0f, 0.0f); + this.m4 = new ModelRenderer(base, 32, 48).addBox(-1.0f, -1.0f, 0.0f, 2, 2, 4); + this.setRotation(this.m4, 0.0f, 0.0f, 0.0f); + this.m5 = new ModelRenderer(base, 32, 48).addBox(-1.0f, -1.0f, 0.0f, 2, 2, 4); + this.setRotation(this.m5, 0.0f, 0.0f, 0.0f); + this.m6 = new ModelRenderer(base, 32, 48).addBox(-1.0f, -1.0f, 0.0f, 2, 2, 4); + this.setRotation(this.m6, 0.0f, 0.0f, 0.0f); + + this.m5.addChild(this.m6); + this.m4.addChild(this.m5); + this.m3.addChild(this.m4); + this.m2.addChild(this.m3); + this.m1.addChild(this.m2); + this.monkey.addChild(this.m1); + + // Init Rotation Points + this.monkey.rotationPointX = 1.0f; + this.monkey.rotationPointY = 10.0f + heightFactor; + this.monkey.rotationPointZ = 2.0f; + this.m1.rotationPointX = -1.0f; + this.m1.rotationPointY = -1.0f; + this.m2.rotationPointZ = 4.0f; + this.m3.rotationPointZ = 4.0f; + this.m4.rotationPointZ = 4.0f; + this.m5.rotationPointZ = 4.0f; + this.m6.rotationPointZ = 4.0f; + + (this.monkey_wrapped = new ModelRenderer(base, 0, 0)).addBox(-0.0f, -0.0f, -0.0f, 0, 0, 0, 0.02f); + this.monkey_wrapped.setRotationPoint(0.0f, 0.0f + heightFactor, 0.0f); + this.mw1 = new ModelRenderer(base, 32, 48).addBox(3.5f, 8.0f, -2.5f, 1, 2, 5); + this.mw1.setRotationPoint(0.0f, 0.0f, 0.0f); + this.setRotation(this.mw1, 0.0f, 0.0f, 0.0f); + this.mw2 = new ModelRenderer(base, 32, 48).addBox(-4.433333f, 8.0f, -2.5f, 1, 2, 5); + this.mw2.setRotationPoint(0.0f, 0.0f, 0.0f); + this.setRotation(this.mw2, 0.0f, 0.0f, 0.0f); + this.mw3 = new ModelRenderer(base, 32, 48).addBox(-3.433333f, 8.0f, 1.5f, 7, 2, 1); + this.mw3.setRotationPoint(0.0f, 0.0f, 0.0f); + this.setRotation(this.mw3, 0.0f, 0.0f, 0.0f); + this.mw4 = new ModelRenderer(base, 32, 48).addBox(-3.433333f, 8.0f, -2.5f, 7, 2, 1); + this.mw4.setRotationPoint(0.0f, 0.0f, 0.0f); + this.setRotation(this.mw4, 0.0f, 0.0f, 0.0f); + + this.monkey_wrapped.rotationPointZ = -0.5f; + + this.monkey_wrapped.addChild(this.mw1); + this.monkey_wrapped.addChild(this.mw2); + this.monkey_wrapped.addChild(this.mw3); + this.monkey_wrapped.addChild(this.mw4); + + this.addChild(monkey); + this.addChild(monkey_wrapped); + this.addChild(monkey_large); + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { + // Scale down the motion values to control the effect + float scale = 0.18f; // Adjust the scale factor as needed + + // Define a damping factor for smoother motion + float damping = 0.6f; // Adjust the damping factor as needed + + double motionX = entity.motionX; + double motionY = -entity.motionY; + + if(!monkey_large.isHidden){ + this.monkey_large.rotateAngleY = 0.2f; + this.monkey_large.rotateAngleX = -0.3f; + this.ml1.rotateAngleY = 0.2f; + this.ml1.rotateAngleX = 0.4f; + this.ml2.rotateAngleY = 0.1f; + this.ml2.rotateAngleX = 0.6f; + this.ml3.rotateAngleY = 0.1f; + this.ml3.rotateAngleX = 0.3f; + this.ml4.rotateAngleY = 0.2f; + this.ml4.rotateAngleX = -0.2f; + this.ml5.rotateAngleY = 0.2f; + this.ml5.rotateAngleX = -0.4f; + + if(isAnimated){ + float angleOffset = 0.01f; + final float r = MathHelper.sin(f2 * 0.02f) * angleOffset; + final float r2 = MathHelper.cos(f2 * 0.02f) * angleOffset; + final float r3 = MathHelper.cos(f2 * 0.14f) * angleOffset; + final float angleSpeed = 0.05f; + float xMotionReducer = 0.2f; + float yMotionReducer = 0.4f; + + monkey_large.rotateAngleY += yMotionReducer * (MathHelper.cos(f2 * angleSpeed) * 0.2f - 0.2f + r); + ml1.rotateAngleY += yMotionReducer * (MathHelper.cos(f2 * angleSpeed) * 0.2f - 0.2f + r2 + r3); + ml2.rotateAngleY += yMotionReducer * (MathHelper.cos(f2 * angleSpeed) * 0.1f - 0.1f + r + r3); + ml2.rotateAngleX += xMotionReducer * (MathHelper.sin(f2 * angleSpeed) * 0.4f + 0.3f); + ml3.rotateAngleY += yMotionReducer * (MathHelper.cos(f2 * angleSpeed) * 0.4f - 0.1f + r2); + ml3.rotateAngleX += xMotionReducer * (MathHelper.sin(f2 * angleSpeed) * 0.1f - 0.2f); + ml4.rotateAngleY += yMotionReducer * (MathHelper.cos(f2 * angleSpeed) * 0.4f - 0.2f + r + r3); + ml4.rotateAngleX += xMotionReducer * (MathHelper.sin(f2 * angleSpeed) * 0.1f - 0.3f); + ml5.rotateAngleY += yMotionReducer * (MathHelper.cos(f2 * angleSpeed) * 0.4f - 0.2f + r2 + r3); + ml5.rotateAngleX += xMotionReducer * (MathHelper.sin(f2 * angleSpeed) * 0.4f - 0.4f); + } + + // Calculate the difference between the current rotation angle and the motion influence + double deltaY = motionY * scale - monkey.rotateAngleX; + double deltaX = motionX * scale - monkey.rotateAngleY; + + // Apply damping to smooth out the motion + + monkey_large.rotateAngleX += deltaY * damping; + ml1.rotateAngleX += deltaY * damping; + ml2.rotateAngleX += deltaY * damping; + ml3.rotateAngleX += deltaY * damping; + ml4.rotateAngleX += deltaY * damping; + ml5.rotateAngleX += deltaY * damping; + + monkey_large.rotateAngleY += deltaX * damping; + ml1.rotateAngleY += deltaX * damping; + ml2.rotateAngleY += deltaX * damping; + ml3.rotateAngleY += deltaX * damping; + ml4.rotateAngleY += deltaX * damping; + ml5.rotateAngleY += deltaX * damping; + + } else if (!monkey.isHidden){ + this.m1.rotateAngleX = -0.3f; + this.m1.rotateAngleY = 0.2f; + this.m2.rotateAngleX = 0.4f; + this.m2.rotateAngleY = 0.2f; + this.m3.rotateAngleX = 0.6f; + this.m3.rotateAngleY = 0.1f; + this.m4.rotateAngleX = 0.3f; + this.m4.rotateAngleY = 0.1f; + this.m5.rotateAngleX = -0.2f; + this.m5.rotateAngleY = 0.2f; + this.m6.rotateAngleX = -0.4f; + this.m6.rotateAngleY = 0.2f; + + if(isAnimated){ + float angleOffset = 0.01f; + final float r4 = MathHelper.sin(f2 * 0.02f) * angleOffset; + final float r5 = MathHelper.cos(f2 * 0.02f) * angleOffset; + final float r6 = MathHelper.cos(f2 * 0.14f) * angleOffset; + final float angleSpeed = 0.05f; + float xMotionReducer = 0.4f; + float yMotionReducer = 0.4f; + + this.m1.rotateAngleY += yMotionReducer * (MathHelper.cos(f2 * angleSpeed) * 0.2f - 0.2f + r4); + this.m2.rotateAngleY += yMotionReducer * (MathHelper.cos(f2 * angleSpeed) * 0.2f - 0.2f + r5 + r6); + + this.m3.rotateAngleX += xMotionReducer * (MathHelper.sin(f2 * angleSpeed) * 0.4f + 0.1f); + this.m3.rotateAngleY += yMotionReducer * (MathHelper.cos(f2 * angleSpeed) * 0.1f - 0.1f + r4 + r6); + + this.m4.rotateAngleX += xMotionReducer * (MathHelper.sin(f2 * angleSpeed) * 0.1f - 0.2f); + this.m4.rotateAngleY += yMotionReducer * (MathHelper.cos(f2 * angleSpeed) * 0.4f - 0.1f + r5); + + this.m5.rotateAngleX += xMotionReducer * (MathHelper.sin(f2 * angleSpeed) * 0.1f - 0.1f); + this.m5.rotateAngleY += yMotionReducer * (MathHelper.cos(f2 * angleSpeed) * 0.4f - 0.2f + r4 + r6); + + this.m6.rotateAngleX += xMotionReducer * (MathHelper.sin(f2 * angleSpeed) * 0.4f - 0.4f); + this.m6.rotateAngleY += yMotionReducer * (MathHelper.cos(f2 * angleSpeed) * 0.4f - 0.2f + r5 + r6); + } + + // Calculate the difference between the current rotation angle and the motion influence + double deltaY = motionY * scale - monkey.rotateAngleX; + double deltaX = motionX * scale - monkey.rotateAngleY; + + // Apply damping to smooth out the motion + m1.rotateAngleX += deltaY * damping; + m2.rotateAngleX += deltaY * damping; + m3.rotateAngleX += deltaY * damping; + m4.rotateAngleX += deltaY * damping; + m5.rotateAngleX += deltaY * damping; + m6.rotateAngleX += deltaY * damping; + + m1.rotateAngleY += deltaX * damping; + m2.rotateAngleY += deltaX * damping; + m3.rotateAngleY += deltaX * damping; + m4.rotateAngleY += deltaX * damping; + m5.rotateAngleY += deltaX * damping; + m6.rotateAngleY += deltaX * damping; + } + } +} diff --git a/src/main/java/noppes/npcs/entity/data/ModelPartData.java b/src/main/java/noppes/npcs/entity/data/ModelPartData.java index 77db24599..ddc17323e 100644 --- a/src/main/java/noppes/npcs/entity/data/ModelPartData.java +++ b/src/main/java/noppes/npcs/entity/data/ModelPartData.java @@ -7,6 +7,7 @@ public class ModelPartData { public int color = 0xFFFFFF; public String texture; public byte type = 0; + public byte pattern = 0; public boolean playerTexture; private ResourceLocation location; @@ -24,6 +25,7 @@ public class ModelPartData { NBTTagCompound compound = new NBTTagCompound(); compound.setByte("Type", type); compound.setInteger("Color", color); + compound.setByte("Pattern", pattern); if(texture != null && !texture.isEmpty()) { compound.setString("Texture", texture); } @@ -35,6 +37,7 @@ public class ModelPartData { type = compound.getByte("Type"); color = compound.getInteger("Color"); texture = compound.getString("Texture"); + pattern = compound.getByte("Pattern"); playerTexture = compound.getBoolean("PlayerTexture"); location = null; } @@ -73,4 +76,4 @@ public class ModelPartData { return str; } -} \ No newline at end of file +} diff --git a/src/main/resources/assets/customnpcs/textures/parts/tail/fox1.png b/src/main/resources/assets/customnpcs/textures/parts/tail/fox1.png new file mode 100644 index 000000000..8385ae7a6 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/parts/tail/fox1.png differ diff --git a/src/main/resources/assets/customnpcs/textures/parts/tail/monkey1.png b/src/main/resources/assets/customnpcs/textures/parts/tail/monkey1.png new file mode 100644 index 000000000..35679a4f9 Binary files /dev/null and b/src/main/resources/assets/customnpcs/textures/parts/tail/monkey1.png differ