2022-12-31 18:47:13 -06:00
|
|
|
package noppes.npcs.controllers.data;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
|
import noppes.npcs.Server;
|
|
|
|
|
import noppes.npcs.api.handler.IPlayerModelData;
|
|
|
|
|
import noppes.npcs.constants.EnumPacketClient;
|
|
|
|
|
import noppes.npcs.roles.JobPuppet;
|
|
|
|
|
|
|
|
|
|
public class PlayerModelData implements IPlayerModelData {
|
|
|
|
|
public PlayerData parent;
|
|
|
|
|
public final EntityPlayer player;
|
|
|
|
|
|
|
|
|
|
public JobPuppet.PartConfig head = new JobPuppet.PartConfig();
|
|
|
|
|
public JobPuppet.PartConfig larm = new JobPuppet.PartConfig();
|
|
|
|
|
public JobPuppet.PartConfig rarm = new JobPuppet.PartConfig();
|
|
|
|
|
public JobPuppet.PartConfig body = new JobPuppet.PartConfig();
|
|
|
|
|
public JobPuppet.PartConfig lleg = new JobPuppet.PartConfig();
|
|
|
|
|
public JobPuppet.PartConfig rleg = new JobPuppet.PartConfig();
|
|
|
|
|
|
|
|
|
|
public boolean enabled = false;
|
|
|
|
|
public boolean whileStanding = true;
|
|
|
|
|
public boolean whileAttacking = false;
|
|
|
|
|
public boolean whileMoving = false;
|
|
|
|
|
public boolean fullAngles = false;
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public float rotationX, rotationY, rotationZ;
|
2023-01-05 17:58:32 -06:00
|
|
|
public boolean rotationEnabledX, rotationEnabledY, rotationEnabledZ;
|
|
|
|
|
|
2022-12-31 18:47:13 -06:00
|
|
|
public boolean animate = false;
|
|
|
|
|
public float animRate = 1.0F;
|
|
|
|
|
|
|
|
|
|
//Client-sided use
|
2023-01-06 13:43:49 -06:00
|
|
|
public float modelRotPartialTicks;
|
|
|
|
|
public float[] modelRotations = {0,0,0};
|
|
|
|
|
|
2022-12-31 18:47:13 -06:00
|
|
|
public float[] bipedRotsHead = {0,0,0};
|
|
|
|
|
public float[] bipedRotsBody = {0,0,0};
|
|
|
|
|
public float[] bipedRotsLeftArm = {0,0,0};
|
|
|
|
|
public float[] bipedRotsRightArm = {0,0,0};
|
|
|
|
|
public float[] bipedRotsLeftLeg = {0,0,0};
|
|
|
|
|
public float[] bipedRotsRightLeg = {0,0,0};
|
|
|
|
|
|
|
|
|
|
public PlayerModelData(PlayerData parent) {
|
|
|
|
|
this.parent = parent;
|
|
|
|
|
this.player = parent.player;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public PlayerModelData(EntityPlayer player) {
|
|
|
|
|
this.player = player;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void updateClient() {
|
|
|
|
|
Server.sendToAll(EnumPacketClient.PLAYER_UPDATE_MODEL_DATA, ((PlayerData) parent).player.getCommandSenderName(), this.writeToNBT(new NBTTagCompound()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
|
|
|
|
compound.setTag("PuppetHead", head.writeNBT());
|
|
|
|
|
compound.setTag("PuppetLArm", larm.writeNBT());
|
|
|
|
|
compound.setTag("PuppetRArm", rarm.writeNBT());
|
|
|
|
|
compound.setTag("PuppetBody", body.writeNBT());
|
|
|
|
|
compound.setTag("PuppetLLeg", lleg.writeNBT());
|
|
|
|
|
compound.setTag("PuppetRLeg", rleg.writeNBT());
|
|
|
|
|
|
|
|
|
|
compound.setBoolean("PuppetEnabled", enabled);
|
|
|
|
|
compound.setBoolean("PuppetStanding", whileStanding);
|
|
|
|
|
compound.setBoolean("PuppetAttacking", whileAttacking);
|
|
|
|
|
compound.setBoolean("PuppetMoving", whileMoving);
|
|
|
|
|
compound.setBoolean("PuppetFullAngles", fullAngles);
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
compound.setFloat("PuppetRotationX",rotationX);
|
|
|
|
|
compound.setFloat("PuppetRotationY",rotationY);
|
|
|
|
|
compound.setFloat("PuppetRotationZ",rotationZ);
|
2023-01-05 17:58:32 -06:00
|
|
|
compound.setBoolean("PuppetRotationEnabledX",rotationEnabledX);
|
|
|
|
|
compound.setBoolean("PuppetRotationEnabledY",rotationEnabledY);
|
|
|
|
|
compound.setBoolean("PuppetRotationEnabledZ",rotationEnabledZ);
|
|
|
|
|
|
2022-12-31 18:47:13 -06:00
|
|
|
compound.setBoolean("PuppetAnimate", animate);
|
|
|
|
|
compound.setFloat("PuppetAnimSpeed", animRate);
|
|
|
|
|
return compound;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void readFromNBT(NBTTagCompound compound) {
|
|
|
|
|
head.readNBT(compound.getCompoundTag("PuppetHead"));
|
|
|
|
|
larm.readNBT(compound.getCompoundTag("PuppetLArm"));
|
|
|
|
|
rarm.readNBT(compound.getCompoundTag("PuppetRArm"));
|
|
|
|
|
body.readNBT(compound.getCompoundTag("PuppetBody"));
|
|
|
|
|
lleg.readNBT(compound.getCompoundTag("PuppetLLeg"));
|
|
|
|
|
rleg.readNBT(compound.getCompoundTag("PuppetRLeg"));
|
|
|
|
|
|
|
|
|
|
enabled = compound.getBoolean("PuppetEnabled");
|
|
|
|
|
whileStanding = compound.getBoolean("PuppetStanding");
|
|
|
|
|
whileAttacking = compound.getBoolean("PuppetAttacking");
|
|
|
|
|
whileMoving = compound.getBoolean("PuppetMoving");
|
|
|
|
|
fullAngles = compound.getBoolean("PuppetFullAngles");
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
rotationX = compound.getFloat("PuppetRotationX");
|
|
|
|
|
rotationY = compound.getFloat("PuppetRotationY");
|
|
|
|
|
rotationZ = compound.getFloat("PuppetRotationZ");
|
2023-01-05 17:58:32 -06:00
|
|
|
rotationEnabledX = compound.getBoolean("PuppetRotationEnabledX");
|
|
|
|
|
rotationEnabledY = compound.getBoolean("PuppetRotationEnabledY");
|
|
|
|
|
rotationEnabledZ = compound.getBoolean("PuppetRotationEnabledZ");
|
|
|
|
|
|
2022-12-31 18:47:13 -06:00
|
|
|
animate = compound.getBoolean("PuppetAnimate");
|
|
|
|
|
animRate = compound.getFloat("PuppetAnimSpeed");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setEnabled(boolean enabled) {
|
|
|
|
|
this.enabled = enabled;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-05 18:18:28 -06:00
|
|
|
public boolean enabled() {
|
2022-12-31 18:47:13 -06:00
|
|
|
return this.enabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setAnimated(boolean animated) {
|
|
|
|
|
this.animate = animated;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-05 18:18:28 -06:00
|
|
|
public boolean isAnimated() {
|
|
|
|
|
return this.animate;
|
2022-12-31 18:47:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setFullAngles(boolean limit) {
|
|
|
|
|
fullAngles = limit;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-05 18:18:28 -06:00
|
|
|
public boolean fullAngles() {
|
|
|
|
|
return fullAngles;
|
2022-12-31 18:47:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setAnimRate(float animRate) {
|
|
|
|
|
this.animRate = animRate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getAnimRate() {
|
|
|
|
|
return this.animRate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void doWhileStanding(boolean whileStanding) {
|
|
|
|
|
this.whileStanding = whileStanding;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean doWhileStanding() {
|
|
|
|
|
return this.whileStanding;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void doWhileAttacking(boolean whileAttacking) {
|
|
|
|
|
this.whileAttacking = whileAttacking;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean doWhileAttacking() {
|
|
|
|
|
return this.whileAttacking;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void doWhileMoving(boolean whileMoving) {
|
|
|
|
|
this.whileMoving = whileMoving;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean doWhileMoving() {
|
|
|
|
|
return this.whileMoving;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public void setRotation(float rotationX, float rotationY, float rotationZ) {
|
2023-01-05 17:58:32 -06:00
|
|
|
this.setRotationX(rotationX);
|
|
|
|
|
this.setRotationY(rotationY);
|
|
|
|
|
this.setRotationZ(rotationZ);
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public void setRotationX(float rotationX) {
|
2023-01-05 17:58:32 -06:00
|
|
|
this.rotationX = rotationX;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public void setRotationY(float rotationY) {
|
2023-01-05 17:58:32 -06:00
|
|
|
this.rotationY = rotationY;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public void setRotationZ(float rotationZ) {
|
2023-01-05 17:58:32 -06:00
|
|
|
this.rotationZ = rotationZ;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public float getRotationX() {
|
|
|
|
|
return rotationX;
|
2023-01-05 17:58:32 -06:00
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public float getRotationY() {
|
|
|
|
|
return rotationY;
|
2023-01-05 17:58:32 -06:00
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public float getRotationZ() {
|
|
|
|
|
return rotationZ;
|
2023-01-05 17:58:32 -06:00
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public void setRotationEnabled(boolean enabledX, boolean enabledY, boolean enabledZ) {
|
|
|
|
|
this.setRotationEnabledX(enabledX);
|
|
|
|
|
this.setRotationEnabledY(enabledY);
|
|
|
|
|
this.setRotationEnabledZ(enabledZ);
|
2023-01-05 17:58:32 -06:00
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public void setRotationEnabledX(boolean enabled) {
|
|
|
|
|
this.rotationEnabledX = enabled;
|
2023-01-05 17:58:32 -06:00
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public void setRotationEnabledY(boolean enabled) {
|
|
|
|
|
this.rotationEnabledY = enabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setRotationEnabledZ(boolean enabled) {
|
|
|
|
|
this.rotationEnabledZ = enabled;
|
2023-01-05 17:58:32 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean rotationEnabledX() {
|
|
|
|
|
return rotationEnabledX;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean rotationEnabledY() {
|
|
|
|
|
return rotationEnabledY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean rotationEnabledZ() {
|
|
|
|
|
return rotationEnabledZ;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public void setRotation(int part, float rotationX, float rotationY, float rotationZ) {
|
2022-12-31 18:47:13 -06:00
|
|
|
this.setRotationX(part,rotationX);
|
|
|
|
|
this.setRotationY(part,rotationY);
|
|
|
|
|
this.setRotationZ(part,rotationZ);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @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
|
|
|
|
|
*/
|
2023-01-06 14:28:15 -06:00
|
|
|
public void setRotationX(int part, float rotation){
|
2022-12-31 18:47:13 -06:00
|
|
|
float f = rotation / 360f - 0.5f;
|
|
|
|
|
|
|
|
|
|
if(part == 0)
|
|
|
|
|
head.rotationX = f;
|
|
|
|
|
if(part == 1)
|
|
|
|
|
body.rotationX = f;
|
|
|
|
|
if(part == 2)
|
|
|
|
|
larm.rotationX = f;
|
|
|
|
|
if(part == 3)
|
|
|
|
|
rarm.rotationX = f;
|
|
|
|
|
if(part == 4)
|
|
|
|
|
lleg.rotationX = f;
|
|
|
|
|
if(part == 5)
|
|
|
|
|
rleg.rotationX = f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @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
|
|
|
|
|
*/
|
2023-01-06 14:28:15 -06:00
|
|
|
public void setRotationY(int part, float rotation){
|
2022-12-31 18:47:13 -06:00
|
|
|
float f = rotation / 360f - 0.5f;
|
|
|
|
|
|
|
|
|
|
if(part == 0)
|
|
|
|
|
head.rotationY = f;
|
|
|
|
|
if(part == 1)
|
|
|
|
|
body.rotationY = f;
|
|
|
|
|
if(part == 2)
|
|
|
|
|
larm.rotationY = f;
|
|
|
|
|
if(part == 3)
|
|
|
|
|
rarm.rotationY = f;
|
|
|
|
|
if(part == 4)
|
|
|
|
|
lleg.rotationY = f;
|
|
|
|
|
if(part == 5)
|
|
|
|
|
rleg.rotationY = f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @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
|
|
|
|
|
*/
|
2023-01-06 14:28:15 -06:00
|
|
|
public void setRotationZ(int part, float rotation){
|
2022-12-31 18:47:13 -06:00
|
|
|
float f = rotation / 360f - 0.5f;
|
|
|
|
|
|
|
|
|
|
if(part == 0)
|
|
|
|
|
head.rotationZ = f;
|
|
|
|
|
if(part == 1)
|
|
|
|
|
body.rotationZ = f;
|
|
|
|
|
if(part == 2)
|
|
|
|
|
larm.rotationZ = f;
|
|
|
|
|
if(part == 3)
|
|
|
|
|
rarm.rotationZ = f;
|
|
|
|
|
if(part == 4)
|
|
|
|
|
lleg.rotationZ = f;
|
|
|
|
|
if(part == 5)
|
|
|
|
|
rleg.rotationZ = f;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
/**
|
|
|
|
|
* @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){
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 0)
|
2023-01-06 14:28:15 -06:00
|
|
|
return head.rotationX;
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 1)
|
2023-01-06 14:28:15 -06:00
|
|
|
return body.rotationX;
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 2)
|
2023-01-06 14:28:15 -06:00
|
|
|
return larm.rotationX;
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 3)
|
2023-01-06 14:28:15 -06:00
|
|
|
return rarm.rotationX;
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 4)
|
2023-01-06 14:28:15 -06:00
|
|
|
return lleg.rotationX;
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 5)
|
2023-01-06 14:28:15 -06:00
|
|
|
return rleg.rotationX;
|
2022-12-31 18:47:13 -06:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
/**
|
|
|
|
|
* @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){
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 0)
|
2023-01-06 14:28:15 -06:00
|
|
|
return head.rotationY;
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 1)
|
2023-01-06 14:28:15 -06:00
|
|
|
return body.rotationY;
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 2)
|
2023-01-06 14:28:15 -06:00
|
|
|
return larm.rotationY;
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 3)
|
2023-01-06 14:28:15 -06:00
|
|
|
return rarm.rotationY;
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 4)
|
2023-01-06 14:28:15 -06:00
|
|
|
return lleg.rotationY;
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 5)
|
2023-01-06 14:28:15 -06:00
|
|
|
return rleg.rotationY;
|
2022-12-31 18:47:13 -06:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
/**
|
|
|
|
|
* @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){
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 0)
|
2023-01-06 14:28:15 -06:00
|
|
|
return head.rotationZ;
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 1)
|
2023-01-06 14:28:15 -06:00
|
|
|
return body.rotationZ;
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 2)
|
2023-01-06 14:28:15 -06:00
|
|
|
return larm.rotationZ;
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 3)
|
2023-01-06 14:28:15 -06:00
|
|
|
return rarm.rotationZ;
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 4)
|
2023-01-06 14:28:15 -06:00
|
|
|
return lleg.rotationZ;
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 5)
|
2023-01-06 14:28:15 -06:00
|
|
|
return rleg.rotationZ;
|
2022-12-31 18:47:13 -06:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public void setOffset(int part, float offsetX, float offsetY, float offsetZ) {
|
2022-12-31 18:47:13 -06:00
|
|
|
this.setOffsetX(part,offsetX);
|
|
|
|
|
this.setOffsetY(part,offsetY);
|
|
|
|
|
this.setOffsetZ(part,offsetZ);
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public void setOffsetX(int part, float offset) {
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 0)
|
|
|
|
|
head.pivotX = offset;
|
|
|
|
|
if(part == 1)
|
|
|
|
|
body.pivotX = offset;
|
|
|
|
|
if(part == 2)
|
|
|
|
|
larm.pivotX = offset;
|
|
|
|
|
if(part == 3)
|
|
|
|
|
rarm.pivotX = offset;
|
|
|
|
|
if(part == 4)
|
|
|
|
|
lleg.pivotX = offset;
|
|
|
|
|
if(part == 5)
|
|
|
|
|
rleg.pivotX = offset;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public void setOffsetY(int part, float offset) {
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 0)
|
|
|
|
|
head.pivotY = offset;
|
|
|
|
|
if(part == 1)
|
|
|
|
|
body.pivotY = offset;
|
|
|
|
|
if(part == 2)
|
|
|
|
|
larm.pivotY = offset;
|
|
|
|
|
if(part == 3)
|
|
|
|
|
rarm.pivotY = offset;
|
|
|
|
|
if(part == 4)
|
|
|
|
|
lleg.pivotY = offset;
|
|
|
|
|
if(part == 5)
|
|
|
|
|
rleg.pivotY = offset;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public void setOffsetZ(int part, float offset) {
|
2022-12-31 18:47:13 -06:00
|
|
|
if(part == 0)
|
|
|
|
|
head.pivotZ = offset;
|
|
|
|
|
if(part == 1)
|
|
|
|
|
body.pivotZ = offset;
|
|
|
|
|
if(part == 2)
|
|
|
|
|
larm.pivotZ = offset;
|
|
|
|
|
if(part == 3)
|
|
|
|
|
rarm.pivotZ = offset;
|
|
|
|
|
if(part == 4)
|
|
|
|
|
lleg.pivotZ = offset;
|
|
|
|
|
if(part == 5)
|
|
|
|
|
rleg.pivotZ = offset;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-06 14:28:15 -06:00
|
|
|
public float getOffsetX(int part) {
|
|
|
|
|
if(part == 0)
|
|
|
|
|
return head.pivotX;
|
|
|
|
|
if(part == 1)
|
|
|
|
|
return body.pivotX;
|
|
|
|
|
if(part == 2)
|
|
|
|
|
return larm.pivotX;
|
|
|
|
|
if(part == 3)
|
|
|
|
|
return rarm.pivotX;
|
|
|
|
|
if(part == 4)
|
|
|
|
|
return lleg.pivotX;
|
|
|
|
|
if(part == 5)
|
|
|
|
|
return rleg.pivotX;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getOffsetY(int part) {
|
|
|
|
|
if(part == 0)
|
|
|
|
|
return head.pivotY;
|
|
|
|
|
if(part == 1)
|
|
|
|
|
return body.pivotY;
|
|
|
|
|
if(part == 2)
|
|
|
|
|
return larm.pivotY;
|
|
|
|
|
if(part == 3)
|
|
|
|
|
return rarm.pivotY;
|
|
|
|
|
if(part == 4)
|
|
|
|
|
return lleg.pivotY;
|
|
|
|
|
if(part == 5)
|
|
|
|
|
return rleg.pivotY;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getOffsetZ(int part) {
|
|
|
|
|
if(part == 0)
|
|
|
|
|
return head.pivotZ;
|
|
|
|
|
if(part == 1)
|
|
|
|
|
return body.pivotZ;
|
|
|
|
|
if(part == 2)
|
|
|
|
|
return larm.pivotZ;
|
|
|
|
|
if(part == 3)
|
|
|
|
|
return rarm.pivotZ;
|
|
|
|
|
if(part == 4)
|
|
|
|
|
return lleg.pivotZ;
|
|
|
|
|
if(part == 5)
|
|
|
|
|
return rleg.pivotZ;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-31 18:47:13 -06:00
|
|
|
/**
|
|
|
|
|
* @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 !head.disabled;
|
|
|
|
|
if(part == 1)
|
|
|
|
|
return !body.disabled;
|
|
|
|
|
if(part == 2)
|
|
|
|
|
return !larm.disabled;
|
|
|
|
|
if(part == 3)
|
|
|
|
|
return !rarm.disabled;
|
|
|
|
|
if(part == 4)
|
|
|
|
|
return !lleg.disabled;
|
|
|
|
|
if(part == 5)
|
|
|
|
|
return !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(part == 0)
|
|
|
|
|
head.disabled = !bo;
|
|
|
|
|
if(part == 1)
|
|
|
|
|
body.disabled = !bo;
|
|
|
|
|
if(part == 2)
|
|
|
|
|
larm.disabled = !bo;
|
|
|
|
|
if(part == 3)
|
|
|
|
|
rarm.disabled = !bo;
|
|
|
|
|
if(part == 4)
|
|
|
|
|
lleg.disabled = !bo;
|
|
|
|
|
if(part == 5)
|
|
|
|
|
rleg.disabled = !bo;
|
|
|
|
|
}
|
|
|
|
|
}
|