mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 21:17:32 +00:00
IJobPuppet:
-Now restructured to use IModelPart to modify puppet parts. -Old functions have been marked as deprecated, but still work.
This commit is contained in:
1 parent
0b809e8210
commit
49f93dfce2
4 files changed
+230
-393
No files matched your search
@@ -42,17 +42,6 @@ public class GuiNpcPuppet extends GuiModelInterface implements ISliderListener,
|
||||
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"}, job.whileAttacking?0:1));
|
||||
addLabel(new GuiNpcLabel(32, "puppet.attacking", guiLeft + 30, y + 5, 0xFFFFFF));
|
||||
addButton(new GuiNpcButton(33, guiLeft + 120, y += 22, 60, 20, new String[]{"gui.yes", "gui.no"}, job.fullAngles ?0:1));
|
||||
addLabel(new GuiNpcLabel(33, "puppet.fullAngles", guiLeft + 30, y + 5, 0xFFFFFF));
|
||||
|
||||
addButton(new GuiNpcButton(35, guiLeft + 120, y += 22, 60, 20, new String[]{"gui.yes", "gui.no"}, job.animate ? 0 : 1));
|
||||
addLabel(new GuiNpcLabel(35, "puppet.animate", guiLeft + 30, y + 5, 0xFFFFFF));
|
||||
|
||||
if (job.animate) {
|
||||
addTextField(new GuiNpcTextField(36, this, guiLeft + 120, y += 22, 40, 20, "" + job.animRate));
|
||||
addLabel(new GuiNpcLabel(36, "puppet.animSpeed", guiLeft + 30, y + 5, 0xFFFFFF));
|
||||
getTextField(36).floatsOnly = true;
|
||||
}
|
||||
|
||||
y += 24;
|
||||
}
|
||||
@@ -178,13 +167,6 @@ public class GuiNpcPuppet extends GuiModelInterface implements ISliderListener,
|
||||
if(btn.id == 32){
|
||||
job.whileAttacking = button.getValue() == 0;
|
||||
}
|
||||
if(btn.id == 33){
|
||||
job.fullAngles = button.getValue() == 0;
|
||||
}
|
||||
if(btn.id == 35){
|
||||
job.animate = button.getValue() == 0;
|
||||
initGui();
|
||||
}
|
||||
if(btn.id == 170 || btn.id == 171 || btn.id == 172){
|
||||
if(btn.id == 170){
|
||||
part.rotationX = 0.0f;
|
||||
@@ -210,10 +192,6 @@ public class GuiNpcPuppet extends GuiModelInterface implements ISliderListener,
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 36) {
|
||||
job.animRate = textfield.getFloat();
|
||||
}
|
||||
|
||||
if(textfield.id == 15) {
|
||||
part.pivotX = textfield.getFloat();
|
||||
}
|
||||
|
||||
@@ -577,8 +577,8 @@ public class ModelMPM extends ModelNPCMale{
|
||||
|
||||
for (int i = 0; i < partConfigs.length; i++) {
|
||||
if (!partConfigs[i].disabled) {
|
||||
this.setInterpolatedAngles(job,mainModelParts[i],partConfigs[i]);
|
||||
this.setInterpolatedAngles(job,armorModelParts[i],partConfigs[i]);
|
||||
this.setInterpolatedAngles(mainModelParts[i],partConfigs[i]);
|
||||
this.setInterpolatedAngles(armorModelParts[i],partConfigs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -622,73 +622,73 @@ public class ModelMPM extends ModelNPCMale{
|
||||
|
||||
for (int i = 0; i < partConfigs.length; i++) {
|
||||
if (!partConfigs[i].disabled) {
|
||||
this.addInterpolatedOffset(job,mainModelParts[i],partConfigs[i]);
|
||||
this.addInterpolatedOffset(job,armorModelParts[i],partConfigs[i]);
|
||||
this.addInterpolatedOffset(mainModelParts[i],partConfigs[i]);
|
||||
this.addInterpolatedOffset(armorModelParts[i],partConfigs[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setInterpolatedAngles(JobPuppet job, ModelRenderer modelPart, JobPuppet.PartConfig puppetPart) {
|
||||
modelPart.rotateAngleX = puppetPart.prevRotations[0];
|
||||
modelPart.rotateAngleY = puppetPart.prevRotations[1];
|
||||
modelPart.rotateAngleZ = puppetPart.prevRotations[2];
|
||||
public void setInterpolatedAngles(ModelRenderer renderer, JobPuppet.PartConfig modelPart) {
|
||||
renderer.rotateAngleX = modelPart.prevRotations[0];
|
||||
renderer.rotateAngleY = modelPart.prevRotations[1];
|
||||
renderer.rotateAngleZ = modelPart.prevRotations[2];
|
||||
|
||||
float pi = (float) Math.PI * (job.fullAngles ? 2 : 1);
|
||||
if (!job.animate) {
|
||||
modelPart.rotateAngleX = puppetPart.rotationX * pi;
|
||||
modelPart.rotateAngleY = puppetPart.rotationY * pi;
|
||||
modelPart.rotateAngleZ = puppetPart.rotationZ * pi;
|
||||
float pi = (float) Math.PI * (modelPart.fullAngles ? 2 : 1);
|
||||
if (!modelPart.animate) {
|
||||
renderer.rotateAngleX = modelPart.rotationX * pi;
|
||||
renderer.rotateAngleY = modelPart.rotationY * pi;
|
||||
renderer.rotateAngleZ = modelPart.rotationZ * pi;
|
||||
} else {
|
||||
if (job.interpolate) {
|
||||
modelPart.rotateAngleX = (puppetPart.rotationX * pi - modelPart.rotateAngleX) * job.animRate / 10f + modelPart.rotateAngleX;
|
||||
modelPart.rotateAngleY = (puppetPart.rotationY * pi - modelPart.rotateAngleY) * job.animRate / 10f + modelPart.rotateAngleY;
|
||||
modelPart.rotateAngleZ = (puppetPart.rotationZ * pi - modelPart.rotateAngleZ) * job.animRate / 10f + modelPart.rotateAngleZ;
|
||||
if (modelPart.interpolate) {
|
||||
renderer.rotateAngleX = (modelPart.rotationX * pi - renderer.rotateAngleX) * modelPart.animRate / 10f + renderer.rotateAngleX;
|
||||
renderer.rotateAngleY = (modelPart.rotationY * pi - renderer.rotateAngleY) * modelPart.animRate / 10f + renderer.rotateAngleY;
|
||||
renderer.rotateAngleZ = (modelPart.rotationZ * pi - renderer.rotateAngleZ) * modelPart.animRate / 10f + renderer.rotateAngleZ;
|
||||
} else {
|
||||
int directionX = Float.compare(puppetPart.rotationX * pi, modelPart.rotateAngleX);
|
||||
modelPart.rotateAngleX += directionX * job.animRate / 10f;
|
||||
modelPart.rotateAngleX = directionX == 1 ?
|
||||
Math.min(puppetPart.rotationX * pi,modelPart.rotateAngleX) : Math.max(puppetPart.rotationX * pi,modelPart.rotateAngleX);
|
||||
int directionY = Float.compare(puppetPart.rotationY * pi, modelPart.rotateAngleY);
|
||||
modelPart.rotateAngleY += directionY * job.animRate / 10f;
|
||||
modelPart.rotateAngleY = directionY == 1 ?
|
||||
Math.min(puppetPart.rotationY * pi,modelPart.rotateAngleY) : Math.max(puppetPart.rotationY * pi,modelPart.rotateAngleY);
|
||||
int directionZ = Float.compare(puppetPart.rotationZ * pi, modelPart.rotateAngleZ);
|
||||
modelPart.rotateAngleZ += directionZ * job.animRate / 10f;
|
||||
modelPart.rotateAngleZ = directionZ == 1 ?
|
||||
Math.min(puppetPart.rotationZ * pi,modelPart.rotateAngleZ) : Math.max(puppetPart.rotationZ * pi,modelPart.rotateAngleZ);
|
||||
int directionX = Float.compare(modelPart.rotationX * pi, renderer.rotateAngleX);
|
||||
renderer.rotateAngleX += directionX * modelPart.animRate / 10f;
|
||||
renderer.rotateAngleX = directionX == 1 ?
|
||||
Math.min(modelPart.rotationX * pi,renderer.rotateAngleX) : Math.max(modelPart.rotationX * pi,renderer.rotateAngleX);
|
||||
int directionY = Float.compare(modelPart.rotationY * pi, renderer.rotateAngleY);
|
||||
renderer.rotateAngleY += directionY * modelPart.animRate / 10f;
|
||||
renderer.rotateAngleY = directionY == 1 ?
|
||||
Math.min(modelPart.rotationY * pi,renderer.rotateAngleY) : Math.max(modelPart.rotationY * pi,renderer.rotateAngleY);
|
||||
int directionZ = Float.compare(modelPart.rotationZ * pi, renderer.rotateAngleZ);
|
||||
renderer.rotateAngleZ += directionZ * modelPart.animRate / 10f;
|
||||
renderer.rotateAngleZ = directionZ == 1 ?
|
||||
Math.min(modelPart.rotationZ * pi,renderer.rotateAngleZ) : Math.max(modelPart.rotationZ * pi,renderer.rotateAngleZ);
|
||||
}
|
||||
}
|
||||
puppetPart.prevRotations = new float[]{modelPart.rotateAngleX,modelPart.rotateAngleY,modelPart.rotateAngleZ};
|
||||
modelPart.prevRotations = new float[]{renderer.rotateAngleX,renderer.rotateAngleY,renderer.rotateAngleZ};
|
||||
}
|
||||
|
||||
public void addInterpolatedOffset(JobPuppet job, ModelRenderer modelPart, JobPuppet.PartConfig puppetPart) {
|
||||
if (!job.animate) {
|
||||
modelPart.rotationPointX += puppetPart.pivotX;
|
||||
modelPart.rotationPointY += puppetPart.pivotY;
|
||||
modelPart.rotationPointZ += puppetPart.pivotZ;
|
||||
public void addInterpolatedOffset(ModelRenderer renderer, JobPuppet.PartConfig modelPart) {
|
||||
if (!modelPart.animate) {
|
||||
renderer.rotationPointX += modelPart.pivotX;
|
||||
renderer.rotationPointY += modelPart.pivotY;
|
||||
renderer.rotationPointZ += modelPart.pivotZ;
|
||||
} else {
|
||||
if (job.interpolate) {
|
||||
modelPart.rotationPointX += puppetPart.prevPivots[0];
|
||||
modelPart.rotationPointY += puppetPart.prevPivots[1];
|
||||
modelPart.rotationPointZ += puppetPart.prevPivots[2];
|
||||
puppetPart.prevPivots[0] = (puppetPart.pivotX - puppetPart.prevPivots[0]) * job.animRate / 10f + puppetPart.prevPivots[0];
|
||||
puppetPart.prevPivots[1] = (puppetPart.pivotY - puppetPart.prevPivots[1]) * job.animRate / 10f + puppetPart.prevPivots[1];
|
||||
puppetPart.prevPivots[2] = (puppetPart.pivotZ - puppetPart.prevPivots[2]) * job.animRate / 10f + puppetPart.prevPivots[2];
|
||||
if (modelPart.interpolate) {
|
||||
renderer.rotationPointX += modelPart.prevPivots[0];
|
||||
renderer.rotationPointY += modelPart.prevPivots[1];
|
||||
renderer.rotationPointZ += modelPart.prevPivots[2];
|
||||
modelPart.prevPivots[0] = (modelPart.pivotX - modelPart.prevPivots[0]) * modelPart.animRate / 10f + modelPart.prevPivots[0];
|
||||
modelPart.prevPivots[1] = (modelPart.pivotY - modelPart.prevPivots[1]) * modelPart.animRate / 10f + modelPart.prevPivots[1];
|
||||
modelPart.prevPivots[2] = (modelPart.pivotZ - modelPart.prevPivots[2]) * modelPart.animRate / 10f + modelPart.prevPivots[2];
|
||||
} else {
|
||||
int directionX = Float.compare(puppetPart.pivotX, modelPart.rotationPointX);
|
||||
modelPart.rotationPointX += directionX * job.animRate / 10f;
|
||||
modelPart.rotationPointX = directionX == 1 ?
|
||||
Math.min(puppetPart.pivotX,modelPart.rotationPointX) : Math.max(puppetPart.pivotX,modelPart.rotationPointX);
|
||||
int directionY = Float.compare(puppetPart.pivotY, modelPart.rotationPointY);
|
||||
modelPart.rotationPointY += directionY * job.animRate / 10f;
|
||||
modelPart.rotationPointY = directionY == 1 ?
|
||||
Math.min(puppetPart.pivotY,modelPart.rotationPointY) : Math.max(puppetPart.pivotY,modelPart.rotationPointY);
|
||||
int directionZ = Float.compare(puppetPart.pivotZ, modelPart.rotationPointZ);
|
||||
modelPart.rotationPointZ += directionZ * job.animRate / 10f;
|
||||
modelPart.rotationPointZ = directionZ == 1 ?
|
||||
Math.min(puppetPart.pivotZ,modelPart.rotationPointZ) : Math.max(puppetPart.pivotZ,modelPart.rotationPointZ);
|
||||
int directionX = Float.compare(modelPart.pivotX, renderer.rotationPointX);
|
||||
renderer.rotationPointX += directionX * modelPart.animRate / 10f;
|
||||
renderer.rotationPointX = directionX == 1 ?
|
||||
Math.min(modelPart.pivotX,renderer.rotationPointX) : Math.max(modelPart.pivotX,renderer.rotationPointX);
|
||||
int directionY = Float.compare(modelPart.pivotY, renderer.rotationPointY);
|
||||
renderer.rotationPointY += directionY * modelPart.animRate / 10f;
|
||||
renderer.rotationPointY = directionY == 1 ?
|
||||
Math.min(modelPart.pivotY,renderer.rotationPointY) : Math.max(modelPart.pivotY,renderer.rotationPointY);
|
||||
int directionZ = Float.compare(modelPart.pivotZ, renderer.rotationPointZ);
|
||||
renderer.rotationPointZ += directionZ * modelPart.animRate / 10f;
|
||||
renderer.rotationPointZ = directionZ == 1 ?
|
||||
Math.min(modelPart.pivotZ,renderer.rotationPointZ) : Math.max(modelPart.pivotZ,renderer.rotationPointZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package noppes.npcs.roles;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.handler.data.IModelPart;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
@@ -15,11 +16,6 @@ public class JobPuppet extends JobInterface{
|
||||
public boolean whileStanding = true;
|
||||
public boolean whileAttacking = false;
|
||||
public boolean whileMoving = false;
|
||||
public boolean fullAngles = false;
|
||||
|
||||
public boolean animate = false;
|
||||
public float animRate = 1.0F;
|
||||
public boolean interpolate = true;
|
||||
|
||||
public JobPuppet(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
@@ -37,11 +33,6 @@ public class JobPuppet extends JobInterface{
|
||||
compound.setBoolean("PuppetStanding", whileStanding);
|
||||
compound.setBoolean("PuppetAttacking", whileAttacking);
|
||||
compound.setBoolean("PuppetMoving", whileMoving);
|
||||
compound.setBoolean("PuppetFullAngles", fullAngles);
|
||||
|
||||
compound.setBoolean("PuppetInterpolate", interpolate);
|
||||
compound.setBoolean("PuppetAnimate", animate);
|
||||
compound.setFloat("PuppetAnimSpeed", animRate);
|
||||
return compound;
|
||||
}
|
||||
|
||||
@@ -57,15 +48,6 @@ public class JobPuppet extends JobInterface{
|
||||
whileStanding = compound.getBoolean("PuppetStanding");
|
||||
whileAttacking = compound.getBoolean("PuppetAttacking");
|
||||
whileMoving = compound.getBoolean("PuppetMoving");
|
||||
fullAngles = compound.getBoolean("PuppetFullAngles");
|
||||
|
||||
if (!compound.hasKey("PuppetInterpolate")) {
|
||||
interpolate = true;
|
||||
} else {
|
||||
interpolate = compound.getBoolean("PuppetInterpolate");
|
||||
}
|
||||
animate = compound.getBoolean("PuppetAnimate");
|
||||
animRate = compound.getFloat("PuppetAnimSpeed");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -88,7 +70,7 @@ public class JobPuppet extends JobInterface{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class PartConfig {
|
||||
public static class PartConfig implements IModelPart {
|
||||
public float rotationX = 0f;
|
||||
public float rotationY = 0f;
|
||||
public float rotationZ = 0f;
|
||||
@@ -96,6 +78,11 @@ public class JobPuppet extends JobInterface{
|
||||
public float pivotY = 0f;
|
||||
public float pivotZ = 0f;
|
||||
|
||||
public boolean fullAngles = false;
|
||||
public boolean animate = false;
|
||||
public float animRate = 1.0F;
|
||||
public boolean interpolate = true;
|
||||
|
||||
//Client-sided use
|
||||
public float[] prevRotations = new float[]{0,0,0};
|
||||
public float[] prevPivots = new float[]{0,0,0};
|
||||
@@ -112,6 +99,11 @@ public class JobPuppet extends JobInterface{
|
||||
compound.setFloat("PivotZ", pivotZ);
|
||||
|
||||
compound.setBoolean("Disabled", disabled);
|
||||
compound.setBoolean("PuppetFullAngles", fullAngles);
|
||||
|
||||
compound.setBoolean("PuppetInterpolate", interpolate);
|
||||
compound.setBoolean("PuppetAnimate", animate);
|
||||
compound.setFloat("PuppetAnimSpeed", animRate);
|
||||
return compound;
|
||||
}
|
||||
|
||||
@@ -124,6 +116,115 @@ public class JobPuppet extends JobInterface{
|
||||
pivotZ = compound.getFloat("PivotZ");
|
||||
|
||||
disabled = compound.getBoolean("Disabled");
|
||||
fullAngles = compound.getBoolean("PuppetFullAngles");
|
||||
|
||||
if (!compound.hasKey("PuppetInterpolate")) {
|
||||
interpolate = true;
|
||||
} else {
|
||||
interpolate = compound.getBoolean("PuppetInterpolate");
|
||||
}
|
||||
animate = compound.getBoolean("PuppetAnimate");
|
||||
animRate = compound.getFloat("PuppetAnimSpeed");
|
||||
}
|
||||
|
||||
public void setEnabled(boolean bo) {
|
||||
this.disabled = !bo;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return !this.disabled;
|
||||
}
|
||||
|
||||
public void setAnimated(boolean animated) {
|
||||
this.animate = animated;
|
||||
}
|
||||
|
||||
public boolean isAnimated() {
|
||||
return this.animate;
|
||||
}
|
||||
|
||||
public void setInterpolated(boolean interpolate) {
|
||||
this.interpolate = interpolate;
|
||||
}
|
||||
|
||||
public boolean isInterpolated() {
|
||||
return this.interpolate;
|
||||
}
|
||||
|
||||
public void setFullAngles(boolean fullAngles) {
|
||||
this.fullAngles = fullAngles;
|
||||
}
|
||||
|
||||
public boolean fullAngles() {
|
||||
return this.fullAngles;
|
||||
}
|
||||
|
||||
public void setAnimRate(float animRate) {
|
||||
this.animRate = animRate;
|
||||
}
|
||||
|
||||
public float getAnimRate() {
|
||||
return this.animRate;
|
||||
}
|
||||
|
||||
public void setRotation(float rotationX, float rotationY, float rotationZ) {
|
||||
this.setRotationX(rotationX);
|
||||
this.setRotationY(rotationY);
|
||||
this.setRotationZ(rotationZ);
|
||||
}
|
||||
|
||||
public void setRotationX(float rotation) {
|
||||
this.rotationX = rotation;
|
||||
}
|
||||
|
||||
public void setRotationY(float rotation) {
|
||||
this.rotationY = rotation;
|
||||
}
|
||||
|
||||
public void setRotationZ(float rotation) {
|
||||
this.rotationZ = rotation;
|
||||
}
|
||||
|
||||
public float getRotationX() {
|
||||
return this.rotationX;
|
||||
}
|
||||
|
||||
public float getRotationY() {
|
||||
return this.rotationY;
|
||||
}
|
||||
|
||||
public float getRotationZ() {
|
||||
return this.rotationZ;
|
||||
}
|
||||
|
||||
public void setOffset(float offsetX, float offsetY, float offsetZ) {
|
||||
this.setOffsetX(offsetX);
|
||||
this.setOffsetY(offsetY);
|
||||
this.setOffsetZ(offsetZ);
|
||||
}
|
||||
|
||||
public void setOffsetX(float offset) {
|
||||
this.pivotX = offset;
|
||||
}
|
||||
|
||||
public void setOffsetY(float offset) {
|
||||
this.pivotY = offset;
|
||||
}
|
||||
|
||||
public void setOffsetZ(float offset) {
|
||||
this.pivotZ = offset;
|
||||
}
|
||||
|
||||
public float getOffsetX() {
|
||||
return this.pivotX;
|
||||
}
|
||||
|
||||
public float getOffsetY() {
|
||||
return this.pivotY;
|
||||
}
|
||||
|
||||
public float getOffsetZ() {
|
||||
return this.pivotZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package noppes.npcs.scripted.roles;
|
||||
|
||||
import noppes.npcs.api.handler.data.IModelPart;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobPuppet;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
@@ -12,38 +13,48 @@ public class ScriptJobPuppet extends ScriptJobInterface implements IJobPuppet {
|
||||
this.job = (JobPuppet) npc.jobInterface;
|
||||
}
|
||||
|
||||
public void setAnimated(boolean animated) {
|
||||
this.job.animate = animated;
|
||||
public IModelPart getPart(int part) {
|
||||
switch (part) {
|
||||
case 0:
|
||||
return job.head;
|
||||
case 1:
|
||||
return job.body;
|
||||
case 2:
|
||||
return job.larm;
|
||||
case 3:
|
||||
return job.rarm;
|
||||
case 4:
|
||||
return job.lleg;
|
||||
case 5:
|
||||
return job.rleg;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isAnimated() {
|
||||
return this.job.animate;
|
||||
public void setAnimated(boolean animated) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
this.getPart(i).setAnimated(animated);
|
||||
}
|
||||
}
|
||||
|
||||
public void setInterpolated(boolean interpolate) {
|
||||
this.job.interpolate = interpolate;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
this.getPart(i).setAnimated(interpolate);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInterpolated() {
|
||||
return this.job.interpolate;
|
||||
}
|
||||
|
||||
public void setFullAngles(boolean limit) {
|
||||
job.fullAngles = limit;
|
||||
}
|
||||
|
||||
public boolean fullAngles() {
|
||||
return job.fullAngles;
|
||||
public void setFullAngles(boolean fullAngles) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
this.getPart(i).setFullAngles(fullAngles);
|
||||
}
|
||||
}
|
||||
|
||||
public void setAnimRate(float animRate) {
|
||||
if (animRate < 0)
|
||||
animRate = 0;
|
||||
this.job.animRate = animRate;
|
||||
}
|
||||
|
||||
public float getAnimRate() {
|
||||
return this.job.animRate;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
this.getPart(i).setAnimRate(animRate);
|
||||
}
|
||||
}
|
||||
|
||||
public void doWhileStanding(boolean whileStanding) {
|
||||
@@ -70,299 +81,46 @@ public class ScriptJobPuppet extends ScriptJobInterface implements IJobPuppet {
|
||||
return this.job.whileMoving;
|
||||
}
|
||||
|
||||
public void setRotation(int part, float rotationX, float rotationY, float rotationZ) {
|
||||
this.setRotationX(part,rotationX);
|
||||
this.setRotationY(part,rotationY);
|
||||
this.setRotationZ(part,rotationZ);
|
||||
@Deprecated
|
||||
public void setRotationX(int part, float rotation) {
|
||||
this.getPart(part).setRotationX(rotation);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param part Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg)
|
||||
* @param rotation Rotation the of the body part
|
||||
*/
|
||||
public void setRotationX(int part, float rotation){
|
||||
float f = rotation / 360f - 0.5f;
|
||||
if(getRotationX(part) != f)
|
||||
npc.script.clientNeedsUpdate = true;
|
||||
|
||||
if(part == 0)
|
||||
job.head.rotationX = f;
|
||||
if(part == 1)
|
||||
job.body.rotationX = f;
|
||||
if(part == 2)
|
||||
job.larm.rotationX = f;
|
||||
if(part == 3)
|
||||
job.rarm.rotationX = f;
|
||||
if(part == 4)
|
||||
job.lleg.rotationX = f;
|
||||
if(part == 5)
|
||||
job.rleg.rotationX = f;
|
||||
@Deprecated
|
||||
public void setRotationY(int part, float rotation) {
|
||||
this.getPart(part).setRotationY(rotation);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param part Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg)
|
||||
* @param rotation Rotation the of the body part
|
||||
*/
|
||||
public void setRotationY(int part, float rotation){
|
||||
float f = rotation / 360f - 0.5f;
|
||||
if(getRotationY(part) != f)
|
||||
npc.script.clientNeedsUpdate = true;
|
||||
|
||||
if(part == 0)
|
||||
job.head.rotationY = f;
|
||||
if(part == 1)
|
||||
job.body.rotationY = f;
|
||||
if(part == 2)
|
||||
job.larm.rotationY = f;
|
||||
if(part == 3)
|
||||
job.rarm.rotationY = f;
|
||||
if(part == 4)
|
||||
job.lleg.rotationY = f;
|
||||
if(part == 5)
|
||||
job.rleg.rotationY = f;
|
||||
@Deprecated
|
||||
public void setRotationZ(int part, float rotation) {
|
||||
this.getPart(part).setRotationZ(rotation);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param part Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg)
|
||||
* @param rotation Rotation the of the body part
|
||||
*/
|
||||
public void setRotationZ(int part, float rotation){
|
||||
float f = rotation / 360f - 0.5f;
|
||||
if(getRotationZ(part) != f)
|
||||
npc.script.clientNeedsUpdate = true;
|
||||
|
||||
if(part == 0)
|
||||
job.head.rotationZ = f;
|
||||
if(part == 1)
|
||||
job.body.rotationZ = f;
|
||||
if(part == 2)
|
||||
job.larm.rotationZ = f;
|
||||
if(part == 3)
|
||||
job.rarm.rotationZ = f;
|
||||
if(part == 4)
|
||||
job.lleg.rotationZ = f;
|
||||
if(part == 5)
|
||||
job.rleg.rotationZ = f;
|
||||
@Deprecated
|
||||
public float getRotationX(int part) {
|
||||
return this.getPart(part).getRotationX();
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param part Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg)
|
||||
* @return Returns X rotation in degrees (0-360)
|
||||
*/
|
||||
public float getRotationX(int part){
|
||||
if(part == 0)
|
||||
return job.head.rotationX;
|
||||
if(part == 1)
|
||||
return job.body.rotationX;
|
||||
if(part == 2)
|
||||
return job.larm.rotationX;
|
||||
if(part == 3)
|
||||
return job.rarm.rotationX;
|
||||
if(part == 4)
|
||||
return job.lleg.rotationX;
|
||||
if(part == 5)
|
||||
return job.rleg.rotationX;
|
||||
return 0;
|
||||
@Deprecated
|
||||
public float getRotationY(int part) {
|
||||
return this.getPart(part).getRotationY();
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param part Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg)
|
||||
* @return Returns Y rotation in degrees (0-360)
|
||||
*/
|
||||
public float getRotationY(int part){
|
||||
if(part == 0)
|
||||
return job.head.rotationY;
|
||||
if(part == 1)
|
||||
return job.body.rotationY;
|
||||
if(part == 2)
|
||||
return job.larm.rotationY;
|
||||
if(part == 3)
|
||||
return job.rarm.rotationY;
|
||||
if(part == 4)
|
||||
return job.lleg.rotationY;
|
||||
if(part == 5)
|
||||
return job.rleg.rotationY;
|
||||
return 0;
|
||||
@Deprecated
|
||||
public float getRotationZ(int part) {
|
||||
return this.getPart(part).getRotationZ();
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param part Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg)
|
||||
* @return Returns Z rotation in degrees (0-360)
|
||||
*/
|
||||
public float getRotationZ(int part){
|
||||
if(part == 0)
|
||||
return job.head.rotationZ;
|
||||
if(part == 1)
|
||||
return job.body.rotationZ;
|
||||
if(part == 2)
|
||||
return job.larm.rotationZ;
|
||||
if(part == 3)
|
||||
return job.rarm.rotationZ;
|
||||
if(part == 4)
|
||||
return job.lleg.rotationZ;
|
||||
if(part == 5)
|
||||
return job.rleg.rotationZ;
|
||||
return 0;
|
||||
@Deprecated
|
||||
public boolean isEnabled(int part) {
|
||||
return this.getPart(part).isEnabled();
|
||||
}
|
||||
|
||||
public void setOffset(int part, float offsetX, float offsetY, float offsetZ) {
|
||||
this.setOffsetX(part,offsetX);
|
||||
this.setOffsetY(part,offsetY);
|
||||
this.setOffsetZ(part,offsetZ);
|
||||
@Deprecated
|
||||
public void setEnabled(int part, boolean bo) {
|
||||
this.getPart(part).setEnabled(bo);
|
||||
}
|
||||
|
||||
public void setOffsetX(int part, float offset) {
|
||||
if(getOffsetX(part) != offset)
|
||||
npc.script.clientNeedsUpdate = true;
|
||||
|
||||
if(part == 0)
|
||||
job.head.pivotX = offset;
|
||||
if(part == 1)
|
||||
job.body.pivotX = offset;
|
||||
if(part == 2)
|
||||
job.larm.pivotX = offset;
|
||||
if(part == 3)
|
||||
job.rarm.pivotX = offset;
|
||||
if(part == 4)
|
||||
job.lleg.pivotX = offset;
|
||||
if(part == 5)
|
||||
job.rleg.pivotX = offset;
|
||||
}
|
||||
|
||||
public void setOffsetY(int part, float offset) {
|
||||
if(getOffsetY(part) != offset)
|
||||
npc.script.clientNeedsUpdate = true;
|
||||
|
||||
if(part == 0)
|
||||
job.head.pivotY = offset;
|
||||
if(part == 1)
|
||||
job.body.pivotY = offset;
|
||||
if(part == 2)
|
||||
job.larm.pivotY = offset;
|
||||
if(part == 3)
|
||||
job.rarm.pivotY = offset;
|
||||
if(part == 4)
|
||||
job.lleg.pivotY = offset;
|
||||
if(part == 5)
|
||||
job.rleg.pivotY = offset;
|
||||
}
|
||||
|
||||
public void setOffsetZ(int part, float offset) {
|
||||
if(getOffsetZ(part) != offset)
|
||||
npc.script.clientNeedsUpdate = true;
|
||||
|
||||
if(part == 0)
|
||||
job.head.pivotZ = offset;
|
||||
if(part == 1)
|
||||
job.body.pivotZ = offset;
|
||||
if(part == 2)
|
||||
job.larm.pivotZ = offset;
|
||||
if(part == 3)
|
||||
job.rarm.pivotZ = offset;
|
||||
if(part == 4)
|
||||
job.lleg.pivotZ = offset;
|
||||
if(part == 5)
|
||||
job.rleg.pivotZ = offset;
|
||||
}
|
||||
|
||||
public float getOffsetX(int part) {
|
||||
if(part == 0)
|
||||
return job.head.pivotX;
|
||||
if(part == 1)
|
||||
return job.body.pivotX;
|
||||
if(part == 2)
|
||||
return job.larm.pivotX;
|
||||
if(part == 3)
|
||||
return job.rarm.pivotX;
|
||||
if(part == 4)
|
||||
return job.lleg.pivotX;
|
||||
if(part == 5)
|
||||
return job.rleg.pivotX;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float getOffsetY(int part) {
|
||||
if(part == 0)
|
||||
return job.head.pivotY;
|
||||
if(part == 1)
|
||||
return job.body.pivotY;
|
||||
if(part == 2)
|
||||
return job.larm.pivotY;
|
||||
if(part == 3)
|
||||
return job.rarm.pivotY;
|
||||
if(part == 4)
|
||||
return job.lleg.pivotY;
|
||||
if(part == 5)
|
||||
return job.rleg.pivotY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float getOffsetZ(int part) {
|
||||
if(part == 0)
|
||||
return job.head.pivotZ;
|
||||
if(part == 1)
|
||||
return job.body.pivotZ;
|
||||
if(part == 2)
|
||||
return job.larm.pivotZ;
|
||||
if(part == 3)
|
||||
return job.rarm.pivotZ;
|
||||
if(part == 4)
|
||||
return job.lleg.pivotZ;
|
||||
if(part == 5)
|
||||
return job.rleg.pivotZ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param part Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg)
|
||||
* @return Returns whether or not the body part is enabled
|
||||
*/
|
||||
public boolean isEnabled(int part){
|
||||
if(part == 0)
|
||||
return !job.head.disabled;
|
||||
if(part == 1)
|
||||
return !job.body.disabled;
|
||||
if(part == 2)
|
||||
return !job.larm.disabled;
|
||||
if(part == 3)
|
||||
return !job.rarm.disabled;
|
||||
if(part == 4)
|
||||
return !job.lleg.disabled;
|
||||
if(part == 5)
|
||||
return !job.rleg.disabled;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param part Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg)
|
||||
* @param bo Whether or not the body part is enabled
|
||||
*/
|
||||
public void setEnabled(int part, boolean bo){
|
||||
if(isEnabled(part) != bo)
|
||||
npc.script.clientNeedsUpdate = true;
|
||||
|
||||
if(part == 0)
|
||||
job.head.disabled = !bo;
|
||||
if(part == 1)
|
||||
job.body.disabled = !bo;
|
||||
if(part == 2)
|
||||
job.larm.disabled = !bo;
|
||||
if(part == 3)
|
||||
job.rarm.disabled = !bo;
|
||||
if(part == 4)
|
||||
job.lleg.disabled = !bo;
|
||||
if(part == 5)
|
||||
job.rleg.disabled = !bo;
|
||||
}
|
||||
@Override
|
||||
public int getType(){
|
||||
return JobType.PUPPET;
|
||||
|
||||
Reference in new issue
Block a user