diff --git a/src/main/java/noppes/npcs/ModelDataShared.java b/src/main/java/noppes/npcs/ModelDataShared.java index 2d04b6902..2455aa461 100644 --- a/src/main/java/noppes/npcs/ModelDataShared.java +++ b/src/main/java/noppes/npcs/ModelDataShared.java @@ -9,12 +9,13 @@ import java.util.HashMap; public class ModelDataShared{ - public ModelPartConfig arms = new ModelPartConfig(); - public ModelPartConfig rarms = new ModelPartConfig(); - public ModelPartConfig body = new ModelPartConfig(); - public ModelPartConfig legs = new ModelPartConfig(); - public ModelPartConfig rlegs = new ModelPartConfig(); - public ModelPartConfig head = new ModelPartConfig(); + public ModelLimbConfig head = new ModelLimbConfig(); + public ModelLimbConfig arms = new ModelLimbConfig(); + public ModelLimbConfig body = new ModelLimbConfig(); + public ModelLimbConfig legs = new ModelLimbConfig(); + + public boolean enableRotation = false; + public ModelRotate rotation = new ModelRotate(); public ModelPartData legParts = new ModelPartData(); @@ -26,15 +27,6 @@ public class ModelDataShared{ private HashMap parts = new HashMap(); public byte breasts = 0; - // Rotations - public boolean enableRotation = false; - public boolean whileStanding = true; - public boolean whileAttacking = false; - public boolean whileMoving = false; - - /////////////////////////////// - // WILL BE PORTED TO ModelPartConfig - // Enabled vs Disabled public byte headwear = 2; public byte bodywear = 0; public byte armwear = 0; @@ -49,8 +41,7 @@ public class ModelDataShared{ public byte hideBody = 0; public byte hideArms = 0; public byte hideLegs = 0; - /////////////////////////////// - + public NBTTagCompound writeToNBT(){ NBTTagCompound compound = new NBTTagCompound(); @@ -60,9 +51,7 @@ public class ModelDataShared{ compound.setTag("HeadConfig", head.writeToNBT()); compound.setTag("BodyConfig", body.writeToNBT()); compound.setTag("ArmsConfig", arms.writeToNBT()); - compound.setTag("RArmsConfig", rarms.writeToNBT()); compound.setTag("LegsConfig", legs.writeToNBT()); - compound.setTag("RLegsConfig", rlegs.writeToNBT()); compound.setTag("LegParts", legParts.writeToNBT()); @@ -79,14 +68,13 @@ public class ModelDataShared{ compound.setByte("hideArms", hideArms); compound.setByte("hideLegs", hideLegs); + compound.setBoolean("EnableRotation", enableRotation); + if(enableRotation) + compound.setTag("ModelRotation", rotation.writeToNBT()); + compound.setByte("Breasts", breasts); compound.setTag("ExtraData", extra); - compound.setBoolean("EnableRotation", enableRotation); - compound.setBoolean("WhileStanding", whileStanding); - compound.setBoolean("WhileAttacking", whileAttacking); - compound.setBoolean("WhileMoving", whileMoving); - NBTTagList list = new NBTTagList(); for(String name : parts.keySet()){ NBTTagCompound item = parts.get(name).writeToNBT(); @@ -104,9 +92,7 @@ public class ModelDataShared{ head.readFromNBT(compound.getCompoundTag("HeadConfig")); body.readFromNBT(compound.getCompoundTag("BodyConfig")); arms.readFromNBT(compound.getCompoundTag("ArmsConfig")); - rarms.readFromNBT(compound.getCompoundTag("RArmsConfig")); legs.readFromNBT(compound.getCompoundTag("LegsConfig")); - rlegs.readFromNBT(compound.getCompoundTag("RLegsConfig")); legParts.readFromNBT(compound.getCompoundTag("LegParts")); @@ -123,14 +109,13 @@ public class ModelDataShared{ hideArms = compound.getByte("hideArms"); hideLegs = compound.getByte("hideLegs"); + enableRotation = compound.getBoolean("EnableRotation"); + if(enableRotation) + rotation.readFromNBT(compound.getCompoundTag("ModelRotation")); + breasts = compound.getByte("Breasts"); extra = compound.getCompoundTag("ExtraData"); - enableRotation = compound.getBoolean("EnableRotation"); - whileStanding = compound.getBoolean("WhileStanding"); - whileAttacking = compound.getBoolean("WhileAttacking"); - whileMoving = compound.getBoolean("WhileMoving"); - HashMap parts = new HashMap(); NBTTagList list = compound.getTagList("Parts", 10); for (int i = 0; i < list.tagCount(); i++) { diff --git a/src/main/java/noppes/npcs/ModelPartConfig.java b/src/main/java/noppes/npcs/ModelLimbConfig.java similarity index 51% rename from src/main/java/noppes/npcs/ModelPartConfig.java rename to src/main/java/noppes/npcs/ModelLimbConfig.java index bacae4b74..aa334e916 100644 --- a/src/main/java/noppes/npcs/ModelPartConfig.java +++ b/src/main/java/noppes/npcs/ModelLimbConfig.java @@ -3,24 +3,11 @@ package noppes.npcs; import net.minecraft.nbt.NBTTagCompound; import noppes.npcs.util.ValueUtil; -public class ModelPartConfig { - // +public class ModelLimbConfig { + public float scaleX = 1, scaleY = 1, scaleZ = 1; public boolean shared = false; - public float rotationX = 0f, rotationY = 0f, rotationZ = 0f; - public boolean disabled = false; - - public boolean hide = false; - // Limbwear [0: None, 1: Normal, 2: Solid] - public byte limbwear = 0; - - public ModelPartConfig(){} - - public ModelPartConfig(byte limbDefault){ - this.limbwear = limbDefault; - } - public NBTTagCompound writeToNBT(){ NBTTagCompound compound = new NBTTagCompound(); compound.setFloat("ScaleX", scaleX); @@ -28,13 +15,6 @@ public class ModelPartConfig { compound.setFloat("ScaleZ", scaleZ); compound.setBoolean("Shared", shared); - compound.setBoolean("Disabled", disabled); - compound.setFloat("RotationX", rotationX); - compound.setFloat("RotationY", rotationY); - compound.setFloat("RotationZ", rotationZ); - -// compound.setByte("Limbwear", limbwear); -// compound.setBoolean("Hide", hide); return compound; } @@ -42,14 +22,6 @@ public class ModelPartConfig { scaleX = ValueUtil.correctFloat(compound.getFloat("ScaleX"), 0.5f, 1.5f); scaleY = ValueUtil.correctFloat(compound.getFloat("ScaleY"), 0.5f, 1.5f); scaleZ = ValueUtil.correctFloat(compound.getFloat("ScaleZ"), 0.5f, 1.5f); - - disabled = compound.getBoolean("Disabled"); - rotationX = ValueUtil.correctFloat(compound.getFloat("RotationX"), -0.5f, 0.5f); - rotationY = ValueUtil.correctFloat(compound.getFloat("RotationY"), -0.5f, 0.5f); - rotationZ = ValueUtil.correctFloat(compound.getFloat("RotationZ"), -0.5f, 0.5f); - -// limbwear = compound.getByte("Limbwear"); -// hide = compound.getBoolean("Hide"); } public String toString(){ diff --git a/src/main/java/noppes/npcs/ModelRotate.java b/src/main/java/noppes/npcs/ModelRotate.java new file mode 100644 index 000000000..1dc07bf74 --- /dev/null +++ b/src/main/java/noppes/npcs/ModelRotate.java @@ -0,0 +1,45 @@ +package noppes.npcs; + +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.util.ValueUtil; + +public class ModelRotate { + // Rotation + public boolean whileStanding = true; + public boolean whileAttacking = false; + public boolean whileMoving = false; + + public ModelRotatePart head = new ModelRotatePart(); + public ModelRotatePart body = new ModelRotatePart(); + public ModelRotatePart larm = new ModelRotatePart(); + public ModelRotatePart rarm = new ModelRotatePart(); + public ModelRotatePart lleg = new ModelRotatePart(); + public ModelRotatePart rleg = new ModelRotatePart(); + + public NBTTagCompound writeToNBT(){ + NBTTagCompound compound = new NBTTagCompound(); + compound.setBoolean("PuppetStanding", whileStanding); + compound.setBoolean("PuppetAttacking", whileAttacking); + compound.setBoolean("PuppetMoving", whileMoving); + compound.setTag("PuppetHead", head.writeToNBT()); + compound.setTag("PuppetBody", body.writeToNBT()); + compound.setTag("PuppetRArm", rarm.writeToNBT()); + compound.setTag("PuppetLArm", larm.writeToNBT()); + compound.setTag("PuppetRLeg", rleg.writeToNBT()); + compound.setTag("PuppetLLeg", lleg.writeToNBT()); + return compound; + } + + public void readFromNBT(NBTTagCompound compound){ + whileStanding = compound.getBoolean("PuppetStanding"); + whileAttacking = compound.getBoolean("PuppetAttacking"); + whileMoving = compound.getBoolean("PuppetMoving"); + head.readFromNBT(compound.getCompoundTag("PuppetHead")); + body.readFromNBT(compound.getCompoundTag("PuppetBody")); + rarm.readFromNBT(compound.getCompoundTag("PuppetRArm")); + larm.readFromNBT(compound.getCompoundTag("PuppetLArm")); + rleg.readFromNBT(compound.getCompoundTag("PuppetRLeg")); + lleg.readFromNBT(compound.getCompoundTag("PuppetLLeg")); + } + +} diff --git a/src/main/java/noppes/npcs/ModelRotatePart.java b/src/main/java/noppes/npcs/ModelRotatePart.java new file mode 100644 index 000000000..e8be64fd7 --- /dev/null +++ b/src/main/java/noppes/npcs/ModelRotatePart.java @@ -0,0 +1,26 @@ +package noppes.npcs; + +import net.minecraft.nbt.NBTTagCompound; +import noppes.npcs.util.ValueUtil; + +public class ModelRotatePart { + public float rotationX = 0f, rotationY = 0f, rotationZ = 0f; + public boolean disabled = false; + + public NBTTagCompound writeToNBT(){ + NBTTagCompound compound = new NBTTagCompound(); + compound.setBoolean("Disabled", disabled); + compound.setFloat("RotationX", rotationX); + compound.setFloat("RotationY", rotationY); + compound.setFloat("RotationZ", rotationZ); + return compound; + } + + public void readFromNBT(NBTTagCompound compound){ + disabled = compound.getBoolean("Disabled"); + rotationX = ValueUtil.correctFloat(compound.getFloat("RotationX"), -0.5f, 0.5f); + rotationY = ValueUtil.correctFloat(compound.getFloat("RotationY"), -0.5f, 0.5f); + rotationZ = ValueUtil.correctFloat(compound.getFloat("RotationZ"), -0.5f, 0.5f); + } + +} diff --git a/src/main/java/noppes/npcs/VersionCompatibility.java b/src/main/java/noppes/npcs/VersionCompatibility.java index 8abebf4f6..5c678df52 100644 --- a/src/main/java/noppes/npcs/VersionCompatibility.java +++ b/src/main/java/noppes/npcs/VersionCompatibility.java @@ -12,7 +12,7 @@ import java.util.Collection; import java.util.List; public class VersionCompatibility { - public static int ModRev = 19; + public static int ModRev = 20; public static void CheckNpcCompatibility(EntityNPCInterface npc, NBTTagCompound compound){ if(npc.npcVersion == ModRev) @@ -113,21 +113,71 @@ public class VersionCompatibility { public static void CheckModelCompatibility(EntityNPCInterface npc, NBTTagCompound compound){ if(npc.npcVersion == ModRev) return; - if(npc.npcVersion < 19) { - NBTTagCompound partData = compound.getCompoundTag("NpcModelData"); + NBTTagCompound modelData = compound.getCompoundTag("NpcModelData"); + if(npc.npcVersion < 20){ + System.out.println("MODEL REV FOUND"); + // Convert Puppet Job + if (compound.hasKey("NpcJob")) { + System.out.println("FOUND JOB " + compound.getInteger("NpcJob")); + if(compound.getInteger("NpcJob") == 9){ + System.out.println("PUPPET JOB"); + // Remove Job + compound.setInteger("NpcJob", 0); + + // Get Puppet Data + boolean moving = compound.getBoolean("PuppetMoving"); + boolean attacking = compound.getBoolean("PuppetAttacking"); + boolean standing = compound.getBoolean("PuppetStanding"); + NBTTagCompound head = compound.getCompoundTag("PuppetHead"); + NBTTagCompound body = compound.getCompoundTag("PuppetBody"); + NBTTagCompound larm = compound.getCompoundTag("PuppetLArm"); + NBTTagCompound rarm = compound.getCompoundTag("PuppetRArm"); + NBTTagCompound lleg = compound.getCompoundTag("PuppetLLeg"); + NBTTagCompound rleg = compound.getCompoundTag("PuppetRLeg"); + + // Enable Rotations + modelData.setBoolean("EnableRotation", true); + // Make New Rotation and Write It + ModelRotate newRotation = new ModelRotate(); + newRotation.whileMoving = moving; + newRotation.whileAttacking = attacking; + newRotation.whileStanding = standing; + NBTTagCompound rotation = newRotation.writeToNBT(); + rotation.setTag("PuppetHead", head); + rotation.setTag("PuppetBody", body); + rotation.setTag("PuppetLArm", larm); + rotation.setTag("PuppetRArm", rarm); + rotation.setTag("PuppetLLeg", lleg); + rotation.setTag("PuppetRLeg", rleg); + modelData.setTag("ModelRotation", rotation); + + // Remove All Old Tags + compound.removeTag("PuppetMoving"); + compound.removeTag("PuppetAttacking"); + compound.removeTag("PuppetStanding"); + compound.removeTag("PuppetHead"); + compound.removeTag("PuppetBody"); + compound.removeTag("PuppetLArm"); + compound.removeTag("PuppetRArm"); + compound.removeTag("PuppetLLeg"); + compound.removeTag("PuppetRLeg"); + } + } + } + if(npc.npcVersion < 19) { // Fix Leg MPM Dependency - if(partData.hasKey("LegParts")){ - NBTTagCompound legParts = partData.getCompoundTag("LegParts"); + if(modelData.hasKey("LegParts")){ + NBTTagCompound legParts = modelData.getCompoundTag("LegParts"); if(legParts.hasKey("Texture")){ legParts.setString("Texture", legParts.getString("Texture").replace("moreplayermodels:textures", "customnpcs:textures/parts")); } - partData.setTag("LegParts", legParts); + modelData.setTag("LegParts", legParts); } // Fix Part MPM Dependency - if(partData.hasKey("Parts")){ - NBTTagList list = partData.getTagList("Parts", 10); + if(modelData.hasKey("Parts")){ + NBTTagList list = modelData.getTagList("Parts", 10); for (int i = 0; i < list.tagCount(); i++) { NBTTagCompound item = list.getCompoundTagAt(i); @@ -137,10 +187,10 @@ public class VersionCompatibility { } list.func_150304_a(i, item); } - partData.setTag("Parts", list); + modelData.setTag("Parts", list); } - compound.setTag("NpcModelData", partData); } + compound.setTag("NpcModelData", modelData); } public static void CheckAvailabilityCompatibility(ICompatibilty compatibilty, NBTTagCompound compound){ diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiModelRotate.java b/src/main/java/noppes/npcs/client/gui/model/GuiModelRotate.java index 89a465e1d..92bbb48b8 100644 --- a/src/main/java/noppes/npcs/client/gui/model/GuiModelRotate.java +++ b/src/main/java/noppes/npcs/client/gui/model/GuiModelRotate.java @@ -2,23 +2,21 @@ package noppes.npcs.client.gui.model; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.nbt.NBTTagCompound; import noppes.npcs.ModelData; -import noppes.npcs.ModelPartConfig; -import noppes.npcs.client.Client; +import noppes.npcs.ModelLimbConfig; +import noppes.npcs.ModelRotatePart; import noppes.npcs.client.gui.util.GuiModelInterface; import noppes.npcs.client.gui.util.GuiNpcButton; import noppes.npcs.client.gui.util.GuiNpcLabel; import noppes.npcs.client.gui.util.GuiNpcSlider; import noppes.npcs.client.gui.util.ISliderListener; -import noppes.npcs.constants.EnumPacketServer; import noppes.npcs.entity.EntityCustomNpc; public class GuiModelRotate extends GuiModelInterface implements ISliderListener{ private GuiScreen parent; private int type = 6; - private ModelPartConfig part; + private ModelRotatePart part; private GuiNpcSlider rotateX; private GuiNpcSlider rotateY; @@ -42,11 +40,11 @@ public class GuiModelRotate extends GuiModelInterface implements ISliderListener if(playerdata.enableRotation){ addLabel(new GuiNpcLabel(26, "gui.settings", guiLeft + 55, y + 5, 0xFFFFFF)); if(type == 6){ - addButton(new GuiNpcButton(30, guiLeft + 120, y += 14, 60, 20, new String[]{"gui.yes", "gui.no"}, playerdata.whileStanding?0:1)); + addButton(new GuiNpcButton(30, guiLeft + 120, y += 14, 60, 20, new String[]{"gui.yes", "gui.no"}, playerdata.rotation.whileStanding?0:1)); addLabel(new GuiNpcLabel(30, "puppet.standing", guiLeft + 30, y + 5, 0xFFFFFF)); - addButton(new GuiNpcButton(31, guiLeft + 120, y += 22, 60, 20, new String[]{"gui.yes", "gui.no"}, playerdata.whileMoving?0:1)); + addButton(new GuiNpcButton(31, guiLeft + 120, y += 22, 60, 20, new String[]{"gui.yes", "gui.no"}, playerdata.rotation.whileMoving?0:1)); addLabel(new GuiNpcLabel(31, "puppet.walking", guiLeft + 30, y + 5, 0xFFFFFF)); - addButton(new GuiNpcButton(32, guiLeft + 120, y += 22, 60, 20, new String[]{"gui.yes", "gui.no"}, playerdata.whileAttacking?0:1)); + addButton(new GuiNpcButton(32, guiLeft + 120, y += 22, 60, 20, new String[]{"gui.yes", "gui.no"}, playerdata.rotation.whileAttacking?0:1)); addLabel(new GuiNpcLabel(32, "puppet.attacking", guiLeft + 30, y + 5, 0xFFFFFF)); y += 24; } @@ -57,7 +55,7 @@ public class GuiModelRotate extends GuiModelInterface implements ISliderListener addLabel(new GuiNpcLabel(20, "model.head", guiLeft + 55, y + 5, 0xFFFFFF)); if(type == 0){ - drawSlider(y, playerdata.head); + drawSlider(y, playerdata.rotation.head); y += 90; } else{ @@ -67,7 +65,7 @@ public class GuiModelRotate extends GuiModelInterface implements ISliderListener addLabel(new GuiNpcLabel(21, "model.body", guiLeft + 55, y + 5, 0xFFFFFF)); if(type == 1){ - drawSlider(y, playerdata.body); + drawSlider(y, playerdata.rotation.body); y += 90; } else{ @@ -77,7 +75,7 @@ public class GuiModelRotate extends GuiModelInterface implements ISliderListener addLabel(new GuiNpcLabel(22, "model.larm", guiLeft + 55, y + 5, 0xFFFFFF)); if(type == 2){ - drawSlider(y, playerdata.arms); + drawSlider(y, playerdata.rotation.larm); y += 90; } else{ @@ -87,7 +85,7 @@ public class GuiModelRotate extends GuiModelInterface implements ISliderListener addLabel(new GuiNpcLabel(23, "model.rarm", guiLeft + 55, y + 5, 0xFFFFFF)); if(type == 3){ - drawSlider(y, playerdata.rarms); + drawSlider(y, playerdata.rotation.rarm); y += 90; } else{ @@ -97,7 +95,7 @@ public class GuiModelRotate extends GuiModelInterface implements ISliderListener addLabel(new GuiNpcLabel(24, "model.lleg", guiLeft + 55, y + 5, 0xFFFFFF)); if(type == 4){ - drawSlider(y, playerdata.legs); + drawSlider(y, playerdata.rotation.lleg); y += 90; } else{ @@ -107,7 +105,7 @@ public class GuiModelRotate extends GuiModelInterface implements ISliderListener addLabel(new GuiNpcLabel(25, "model.rleg", guiLeft + 55, y + 5, 0xFFFFFF)); if(type == 5){ - drawSlider(y, playerdata.rlegs); + drawSlider(y, playerdata.rotation.rleg); y += 90; } else{ @@ -117,9 +115,9 @@ public class GuiModelRotate extends GuiModelInterface implements ISliderListener } } - private void drawSlider(int y, ModelPartConfig config){ + private void drawSlider(int y, ModelRotatePart config){ part = config; - addButton(new GuiNpcButton(29, guiLeft + 100, y , 80, 20, new String[]{"gui.enabled","gui.disabled"}, config.disabled?1:0)); + addButton(new GuiNpcButton(29, guiLeft + 100, y , 80, 20, new String[]{"gui.enabled","gui.disabled"}, config.disabled ?1:0)); y += 22; addLabel(new GuiNpcLabel(10, "X", guiLeft, y + 5, 0xFFFFFF)); rotateX = new GuiNpcSlider(this, 10, guiLeft + 50, y, config.rotationX + 0.5f); @@ -157,13 +155,13 @@ public class GuiModelRotate extends GuiModelInterface implements ISliderListener part.disabled = button.getValue() == 1; } if(btn.id == 30){ - playerdata.whileStanding = button.getValue() == 0; + playerdata.rotation.whileStanding = button.getValue() == 0; } if(btn.id == 31){ - playerdata.whileMoving = button.getValue() == 0; + playerdata.rotation.whileMoving = button.getValue() == 0; } if(btn.id == 32){ - playerdata.whileAttacking = button.getValue() == 0; + playerdata.rotation.whileAttacking = button.getValue() == 0; } if(btn.id == 170 || btn.id == 171 || btn.id == 172){ if(btn.id == 170){ diff --git a/src/main/java/noppes/npcs/client/gui/model/GuiModelScale.java b/src/main/java/noppes/npcs/client/gui/model/GuiModelScale.java index 752b58c10..3ff91ebfc 100644 --- a/src/main/java/noppes/npcs/client/gui/model/GuiModelScale.java +++ b/src/main/java/noppes/npcs/client/gui/model/GuiModelScale.java @@ -3,7 +3,7 @@ package noppes.npcs.client.gui.model; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import noppes.npcs.ModelData; -import noppes.npcs.ModelPartConfig; +import noppes.npcs.ModelLimbConfig; import noppes.npcs.client.gui.util.*; import noppes.npcs.entity.EntityCustomNpc; @@ -71,7 +71,7 @@ public class GuiModelScale extends GuiModelInterface implements ISliderListener{ } } - private void drawSlider(int y, ModelPartConfig config){ + private void drawSlider(int y, ModelLimbConfig config){ y += 20; addLabel(new GuiNpcLabel(10, "Width", guiLeft - 25 + offset, y + 5, 0xFFFFFF)); scaleWidth = new GuiNpcSlider(this, 10, guiLeft + 50 + offset, y, config.scaleX - 0.5f); @@ -100,7 +100,7 @@ public class GuiModelScale extends GuiModelInterface implements ISliderListener{ } else{ // Resetting Type - ModelPartConfig config = playerdata.head; + ModelLimbConfig config = playerdata.head; if(type == 1) config = playerdata.body; else if(type == 2) @@ -143,7 +143,7 @@ public class GuiModelScale extends GuiModelInterface implements ISliderListener{ public void mouseDragged(GuiNpcSlider slider) { int percent = (int) (50 + slider.sliderValue * 100); slider.setString(percent + "%"); - ModelPartConfig config = playerdata.head; + ModelLimbConfig config = playerdata.head; if(type == 1) config = playerdata.body; else if(type == 2) diff --git a/src/main/java/noppes/npcs/client/model/ModelMPM.java b/src/main/java/noppes/npcs/client/model/ModelMPM.java index 4bbe84450..a5004bd7d 100644 --- a/src/main/java/noppes/npcs/client/model/ModelMPM.java +++ b/src/main/java/noppes/npcs/client/model/ModelMPM.java @@ -11,8 +11,6 @@ import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import noppes.npcs.*; import noppes.npcs.api.ISkinOverlay; -import noppes.npcs.api.handler.data.IFramePart; -import noppes.npcs.client.ClientEventHandler; import noppes.npcs.client.model.animation.AniCrawling; import noppes.npcs.client.model.animation.AniHug; import noppes.npcs.client.model.part.*; @@ -450,22 +448,22 @@ public class ModelMPM extends ModelNPCMale{ if(isRotationActive(npc)){ float pi = (float) Math.PI; - if(!npc.modelData.head.disabled){ - bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX = npc.modelData.head.rotationX * pi; - bipedHeadwear.rotateAngleY = bipedHead.rotateAngleY = npc.modelData.head.rotationY * pi; - bipedHeadwear.rotateAngleZ = bipedHead.rotateAngleZ = npc.modelData.head.rotationZ * pi; + if(!npc.modelData.rotation.head.disabled){ + bipedHeadwear.rotateAngleX = bipedHead.rotateAngleX = npc.modelData.rotation.head.rotationX * pi; + bipedHeadwear.rotateAngleY = bipedHead.rotateAngleY = npc.modelData.rotation.head.rotationY * pi; + bipedHeadwear.rotateAngleZ = bipedHead.rotateAngleZ = npc.modelData.rotation.head.rotationZ * pi; } - if(!npc.modelData.body.disabled){ - bipedBody.rotateAngleX = npc.modelData.body.rotationX * pi; - bipedBody.rotateAngleY = npc.modelData.body.rotationY * pi; - bipedBody.rotateAngleZ = npc.modelData.body.rotationZ * pi; + if(!npc.modelData.rotation.body.disabled){ + bipedBody.rotateAngleX = npc.modelData.rotation.body.rotationX * pi; + bipedBody.rotateAngleY = npc.modelData.rotation.body.rotationY * pi; + bipedBody.rotateAngleZ = npc.modelData.rotation.body.rotationZ * pi; } - if(!npc.modelData.arms.disabled){ - bipedLeftArm.rotateAngleX = npc.modelData.arms.rotationX * pi; - bipedLeftArm.rotateAngleY = npc.modelData.arms.rotationY * pi; - bipedLeftArm.rotateAngleZ = npc.modelData.arms.rotationZ * pi; + if(!npc.modelData.rotation.larm.disabled){ + bipedLeftArm.rotateAngleX = npc.modelData.rotation.larm.rotationX * pi; + bipedLeftArm.rotateAngleY = npc.modelData.rotation.larm.rotationY * pi; + bipedLeftArm.rotateAngleZ = npc.modelData.rotation.larm.rotationZ * pi; if(!npc.display.disableLivingAnimation){ this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; @@ -473,10 +471,10 @@ public class ModelMPM extends ModelNPCMale{ } } - if(!npc.modelData.rarms.disabled){ - bipedRightArm.rotateAngleX = npc.modelData.rarms.rotationX * pi; - bipedRightArm.rotateAngleY = npc.modelData.rarms.rotationY * pi; - bipedRightArm.rotateAngleZ = npc.modelData.rarms.rotationZ * pi; + if(!npc.modelData.rotation.rarm.disabled){ + bipedRightArm.rotateAngleX = npc.modelData.rotation.rarm.rotationX * pi; + bipedRightArm.rotateAngleY = npc.modelData.rotation.rarm.rotationY * pi; + bipedRightArm.rotateAngleZ = npc.modelData.rotation.rarm.rotationZ * pi; if(!npc.display.disableLivingAnimation){ this.bipedRightArm.rotateAngleZ += MathHelper.cos(par3 * 0.09F) * 0.05F + 0.05F; @@ -484,16 +482,16 @@ public class ModelMPM extends ModelNPCMale{ } } - if(!npc.modelData.rlegs.disabled){ - bipedRightLeg.rotateAngleX = npc.modelData.rlegs.rotationX * pi; - bipedRightLeg.rotateAngleY = npc.modelData.rlegs.rotationY * pi; - bipedRightLeg.rotateAngleZ = npc.modelData.rlegs.rotationZ * pi; + if(!npc.modelData.rotation.rleg.disabled){ + bipedRightLeg.rotateAngleX = npc.modelData.rotation.rleg.rotationX * pi; + bipedRightLeg.rotateAngleY = npc.modelData.rotation.rleg.rotationY * pi; + bipedRightLeg.rotateAngleZ = npc.modelData.rotation.rleg.rotationZ * pi; } - if(!npc.modelData.legs.disabled){ - bipedLeftLeg.rotateAngleX = npc.modelData.legs.rotationX * pi; - bipedLeftLeg.rotateAngleY = npc.modelData.legs.rotationY * pi; - bipedLeftLeg.rotateAngleZ = npc.modelData.legs.rotationZ * pi; + if(!npc.modelData.rotation.lleg.disabled){ + bipedLeftLeg.rotateAngleX = npc.modelData.rotation.lleg.rotationX * pi; + bipedLeftLeg.rotateAngleY = npc.modelData.rotation.lleg.rotationY * pi; + bipedLeftLeg.rotateAngleZ = npc.modelData.rotation.lleg.rotationZ * pi; } } } @@ -738,7 +736,7 @@ public class ModelMPM extends ModelNPCMale{ float dancing = entity.ticksExisted / 4f; GL11.glTranslatef((float)Math.sin(dancing) * 0.075F, (float)Math.abs(Math.cos(dancing)) * 0.125F - 0.02F, (float)(-Math.abs(Math.cos(dancing))) * 0.075F); } - ModelPartConfig head = entity.modelData.head; + ModelLimbConfig head = entity.modelData.head; this.copyAnglesPivots(headwear,bipedHead); this.copyAnglesPivots(bipedHeadwear,bipedHead); @@ -774,7 +772,7 @@ public class ModelMPM extends ModelNPCMale{ GL11.glTranslatef((float)Math.sin(dancing) * 0.015F, 0.0F, 0.0F); } - ModelPartConfig body = entity.modelData.body; + ModelLimbConfig body = entity.modelData.body; // Hide Body ((ModelScaleRenderer)this.bipedBody).isHidden = entity.modelData.hideBody == 1; @@ -806,7 +804,7 @@ public class ModelMPM extends ModelNPCMale{ } public void renderArms(EntityCustomNpc entity, float f, boolean bo){ loadPlayerTexture(entity); - ModelPartConfig arms = entity.modelData.arms; + ModelLimbConfig arms = entity.modelData.arms; float x = (1 - entity.modelData.body.scaleX) * 0.25f + (1 - arms.scaleX) * 0.075f; float y = entity.modelData.getBodyY() + (1 - arms.scaleY) * -0.1f; @@ -885,7 +883,7 @@ public class ModelMPM extends ModelNPCMale{ } private void renderLegs(EntityCustomNpc entity, float f) { loadPlayerTexture(entity); - ModelPartConfig legs = entity.modelData.legs; + ModelLimbConfig legs = entity.modelData.legs; float x = (1 - legs.scaleX) * 0.125f; float y = entity.modelData.getLegsY(); @@ -1011,7 +1009,7 @@ public class ModelMPM extends ModelNPCMale{ if(!npc.isEntityAlive()) return false; - if(npc.modelData.whileAttacking && npc.isAttacking() || npc.modelData.whileMoving && npc.isWalking() || npc.modelData.whileStanding && !npc.isWalking()) + if(npc.modelData.rotation.whileAttacking && npc.isAttacking() || npc.modelData.rotation.whileMoving && npc.isWalking() || npc.modelData.rotation.whileStanding && !npc.isWalking()) return true; return false; } diff --git a/src/main/java/noppes/npcs/client/model/util/ModelScaleRenderer.java b/src/main/java/noppes/npcs/client/model/util/ModelScaleRenderer.java index cadf0a3dd..cd2e6c90a 100644 --- a/src/main/java/noppes/npcs/client/model/util/ModelScaleRenderer.java +++ b/src/main/java/noppes/npcs/client/model/util/ModelScaleRenderer.java @@ -5,7 +5,7 @@ import net.minecraft.client.model.ModelBox; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.Tessellator; -import noppes.npcs.ModelPartConfig; +import noppes.npcs.ModelLimbConfig; import org.lwjgl.opengl.GL11; public class ModelScaleRenderer extends ModelRenderer { @@ -15,7 +15,7 @@ public class ModelScaleRenderer extends ModelRenderer { /** The GL display list rendered by the Tessellator for this model */ public int displayList; - protected ModelPartConfig config; + protected ModelLimbConfig config; public float x, y, z; @@ -28,7 +28,7 @@ public class ModelScaleRenderer extends ModelRenderer { this.setTextureOffset(par2, par3); } - public void setConfig(ModelPartConfig config, float x, float y, float z){ + public void setConfig(ModelLimbConfig config, float x, float y, float z){ this.config = config; this.x = x; this.y = y;