mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 03:07:34 +00:00
Fixed rotation and offset functions setting values that are too high.
This commit is contained in:
1 parent
01848e82c8
commit
a5903c24b9
1 file changed
+28
-7
@@ -6,12 +6,12 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
public class JobPuppet extends JobInterface{
|
||||
public PartConfig head = new PartConfig();
|
||||
public PartConfig larm = new PartConfig();
|
||||
public PartConfig rarm = new PartConfig();
|
||||
public PartConfig body = new PartConfig();
|
||||
public PartConfig lleg = new PartConfig();
|
||||
public PartConfig rleg = new PartConfig();
|
||||
public PartConfig head = new PartConfig(this);
|
||||
public PartConfig larm = new PartConfig(this);
|
||||
public PartConfig rarm = new PartConfig(this);
|
||||
public PartConfig body = new PartConfig(this);
|
||||
public PartConfig lleg = new PartConfig(this);
|
||||
public PartConfig rleg = new PartConfig(this);
|
||||
|
||||
public boolean whileStanding = true;
|
||||
public boolean whileAttacking = false;
|
||||
@@ -71,6 +71,8 @@ public class JobPuppet extends JobInterface{
|
||||
}
|
||||
|
||||
public static class PartConfig implements IModelPart {
|
||||
public Object parent;
|
||||
|
||||
public float rotationX = 0f;
|
||||
public float rotationY = 0f;
|
||||
public float rotationZ = 0f;
|
||||
@@ -88,6 +90,10 @@ public class JobPuppet extends JobInterface{
|
||||
public float[] prevPivots = new float[]{0,0,0};
|
||||
|
||||
public boolean disabled = false;
|
||||
|
||||
public PartConfig(Object parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeNBT(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
@@ -174,14 +180,23 @@ public class JobPuppet extends JobInterface{
|
||||
}
|
||||
|
||||
public void setRotationX(float rotation) {
|
||||
this.rotationX = 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 = rotation;
|
||||
}
|
||||
|
||||
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 = rotation;
|
||||
}
|
||||
|
||||
@@ -204,14 +219,20 @@ public class JobPuppet extends JobInterface{
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user