Changes to ModelPartConfigNEW

This commit is contained in:
Luis C.M committed 2023-01-12 00:11:12 -06:00
1 parent 816873dcd8
commit 074f3ee88b
2 files changed
+7 -31

No files matched your search

@@ -5,6 +5,7 @@ import noppes.npcs.roles.JobPuppet;
import noppes.npcs.util.ValueUtil;
public class ModelPartAnimate {
public boolean enabled = false;
public boolean fullAngles = false;
public boolean animate = false;
public float animRate = 1.0F;
@@ -55,12 +56,12 @@ public class ModelPartAnimate {
animRate = compound.getFloat("PuppetAnimSpeed");
}
public void setEnabled(boolean bo) {
this.disabled = !bo;
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public boolean isEnabled() {
return !this.disabled;
return this.enabled;
}
public void setAnimated(boolean animated) {
@@ -103,22 +104,16 @@ public class ModelPartAnimate {
public void setRotationX(float rotation) {
float f = rotation / 360f - 0.5f;
if (this.getRotationX() != f && parent instanceof JobPuppet)
((JobPuppet) parent).npc.script.clientNeedsUpdate = true;
this.rotationX = f;
}
public void setRotationY(float rotation) {
float f = rotation / 360f - 0.5f;
if (this.getRotationY() != f && parent instanceof JobPuppet)
((JobPuppet) parent).npc.script.clientNeedsUpdate = true;
this.rotationY = f;
}
public void setRotationZ(float rotation) {
float f = rotation / 360f - 0.5f;
if (this.getRotationZ() != f && parent instanceof JobPuppet)
((JobPuppet) parent).npc.script.clientNeedsUpdate = true;
this.rotationZ = f;
}
@@ -141,20 +136,14 @@ public class ModelPartAnimate {
}
public void setOffsetX(float offset) {
if (this.getOffsetX() != offset && parent instanceof JobPuppet)
((JobPuppet) parent).npc.script.clientNeedsUpdate = true;
this.pivotX = offset;
}
public void setOffsetY(float offset) {
if (this.getOffsetY() != offset && parent instanceof JobPuppet)
((JobPuppet) parent).npc.script.clientNeedsUpdate = true;
this.pivotY = offset;
}
public void setOffsetZ(float offset) {
if (this.getOffsetZ() != offset && parent instanceof JobPuppet)
((JobPuppet) parent).npc.script.clientNeedsUpdate = true;
this.pivotZ = offset;
}
@@ -7,7 +7,6 @@ public class ModelPartConfigNEW {
public float scaleX = 1, scaleY = 1, scaleZ = 1;
public float transX = 0, transY = 0, transZ = 0;
public boolean enableAnimate = false;
public ModelPartAnimate animate = new ModelPartAnimate();
public NBTTagCompound writeToNBT(){
@@ -15,20 +14,12 @@ public class ModelPartConfigNEW {
compound.setFloat("ScaleX", scaleX);
compound.setFloat("ScaleY", scaleY);
compound.setFloat("ScaleZ", scaleZ);
compound.setFloat("TransX", transX);
compound.setFloat("TransY", transY);
compound.setFloat("TransZ", transZ);
// SAVE ANIMATE
if(enableAnimate){
// LOUIS
// SAVE ANIMATE VARIABLE
// which contains the PartConfig
if (animate.enabled) {
compound.setTag("Animate",animate.writeNBT());
}
return compound;
}
@@ -37,11 +28,7 @@ public class ModelPartConfigNEW {
scaleY = ValueUtil.correctFloat(compound.getFloat("ScaleY"), 0.5f, 1.5f);
scaleZ = ValueUtil.correctFloat(compound.getFloat("ScaleZ"), 0.5f, 1.5f);
transX = compound.getFloat("TransX");
transY = compound.getFloat("TransY");
transZ = compound.getFloat("TransZ");
// LOAD enableAnimate
animate.readNBT(compound.getCompoundTag("Animate"));
}
public String toString(){