mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 16:09:05 +00:00
IPlayerModelData:
-Restructured to implement the new IModelPart interface
This commit is contained in:
1 parent
f98a1af2b2
commit
c146a973f0
5 files changed
+92
-461
No files matched your search
@@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.api.handler.IPlayerModelData;
|
||||
import noppes.npcs.api.handler.data.IModelPart;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.roles.JobPuppet;
|
||||
|
||||
@@ -19,16 +20,12 @@ public class PlayerModelData implements IPlayerModelData {
|
||||
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;
|
||||
|
||||
public float rotationX, rotationY, rotationZ;
|
||||
public boolean rotationEnabledX, rotationEnabledY, rotationEnabledZ;
|
||||
|
||||
public boolean animate = false;
|
||||
public float animRate = 1.0F;
|
||||
public boolean fullAngles;
|
||||
public boolean interpolate;
|
||||
|
||||
//Client-sided use
|
||||
@@ -48,6 +45,24 @@ public class PlayerModelData implements IPlayerModelData {
|
||||
Server.sendToAll(EnumPacketClient.PLAYER_UPDATE_MODEL_DATA, ((PlayerData) parent).player.getCommandSenderName(), this.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
public IModelPart getPart(int part) {
|
||||
switch (part) {
|
||||
case 0:
|
||||
return this.head;
|
||||
case 1:
|
||||
return this.body;
|
||||
case 2:
|
||||
return this.larm;
|
||||
case 3:
|
||||
return this.rarm;
|
||||
case 4:
|
||||
return this.lleg;
|
||||
case 5:
|
||||
return this.rleg;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.setTag("PuppetHead", head.writeNBT());
|
||||
compound.setTag("PuppetLArm", larm.writeNBT());
|
||||
@@ -57,10 +72,6 @@ public class PlayerModelData implements IPlayerModelData {
|
||||
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);
|
||||
|
||||
compound.setFloat("PuppetRotationX",rotationX);
|
||||
compound.setFloat("PuppetRotationY",rotationY);
|
||||
@@ -69,6 +80,7 @@ public class PlayerModelData implements IPlayerModelData {
|
||||
compound.setBoolean("PuppetRotationEnabledY",rotationEnabledY);
|
||||
compound.setBoolean("PuppetRotationEnabledZ",rotationEnabledZ);
|
||||
|
||||
compound.setBoolean("PuppetFullAngles", fullAngles);
|
||||
compound.setBoolean("PuppetInterpolate", interpolate);
|
||||
compound.setBoolean("PuppetAnimate", animate);
|
||||
compound.setFloat("PuppetAnimSpeed", animRate);
|
||||
@@ -84,10 +96,6 @@ public class PlayerModelData implements IPlayerModelData {
|
||||
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");
|
||||
|
||||
rotationX = compound.getFloat("PuppetRotationX");
|
||||
rotationY = compound.getFloat("PuppetRotationY");
|
||||
@@ -96,6 +104,7 @@ public class PlayerModelData implements IPlayerModelData {
|
||||
rotationEnabledY = compound.getBoolean("PuppetRotationEnabledY");
|
||||
rotationEnabledZ = compound.getBoolean("PuppetRotationEnabledZ");
|
||||
|
||||
fullAngles = compound.getBoolean("PuppetFullAngles");
|
||||
if (!compound.hasKey("PuppetInterpolate")) {
|
||||
interpolate = true;
|
||||
} else {
|
||||
@@ -105,405 +114,29 @@ public class PlayerModelData implements IPlayerModelData {
|
||||
animRate = compound.getFloat("PuppetAnimSpeed");
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public boolean enabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
public void setAnimated(boolean animated) {
|
||||
this.animate = animated;
|
||||
}
|
||||
|
||||
public boolean isAnimated() {
|
||||
return this.animate;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
this.getPart(i).setAnimated(animated);
|
||||
}
|
||||
}
|
||||
|
||||
public void setInterpolated(boolean interpolate) {
|
||||
this.interpolate = interpolate;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
this.getPart(i).setAnimated(interpolate);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInterpolated() {
|
||||
return this.interpolate;
|
||||
}
|
||||
|
||||
public void setFullAngles(boolean limit) {
|
||||
fullAngles = limit;
|
||||
}
|
||||
|
||||
public boolean fullAngles() {
|
||||
return 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.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;
|
||||
}
|
||||
|
||||
public void setRotation(float rotationX, float rotationY, float rotationZ) {
|
||||
this.setRotationX(rotationX);
|
||||
this.setRotationY(rotationY);
|
||||
this.setRotationZ(rotationZ);
|
||||
}
|
||||
|
||||
public void setRotationX(float rotationX) {
|
||||
this.rotationX = rotationX;
|
||||
}
|
||||
|
||||
public void setRotationY(float rotationY) {
|
||||
this.rotationY = rotationY;
|
||||
}
|
||||
|
||||
public void setRotationZ(float rotationZ) {
|
||||
this.rotationZ = rotationZ;
|
||||
}
|
||||
|
||||
public float getRotationX() {
|
||||
return rotationX;
|
||||
}
|
||||
|
||||
public float getRotationY() {
|
||||
return rotationY;
|
||||
}
|
||||
|
||||
public float getRotationZ() {
|
||||
return rotationZ;
|
||||
}
|
||||
|
||||
public void setRotationEnabled(boolean enabledX, boolean enabledY, boolean enabledZ) {
|
||||
this.setRotationEnabledX(enabledX);
|
||||
this.setRotationEnabledY(enabledY);
|
||||
this.setRotationEnabledZ(enabledZ);
|
||||
}
|
||||
|
||||
public void setRotationEnabledX(boolean enabled) {
|
||||
this.rotationEnabledX = enabled;
|
||||
}
|
||||
|
||||
public void setRotationEnabledY(boolean enabled) {
|
||||
this.rotationEnabledY = enabled;
|
||||
}
|
||||
|
||||
public void setRotationEnabledZ(boolean enabled) {
|
||||
this.rotationEnabledZ = enabled;
|
||||
}
|
||||
|
||||
public boolean rotationEnabledX() {
|
||||
return rotationEnabledX;
|
||||
}
|
||||
|
||||
public boolean rotationEnabledY() {
|
||||
return rotationEnabledY;
|
||||
}
|
||||
|
||||
public boolean rotationEnabledZ() {
|
||||
return rotationEnabledZ;
|
||||
}
|
||||
|
||||
public void setRotation(int part, float rotationX, float rotationY, float rotationZ) {
|
||||
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
|
||||
*/
|
||||
public void setRotationX(int part, float rotation){
|
||||
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
|
||||
*/
|
||||
public void setRotationY(int part, float rotation){
|
||||
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
|
||||
*/
|
||||
public void setRotationZ(int part, float rotation){
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 head.rotationX;
|
||||
if(part == 1)
|
||||
return body.rotationX;
|
||||
if(part == 2)
|
||||
return larm.rotationX;
|
||||
if(part == 3)
|
||||
return rarm.rotationX;
|
||||
if(part == 4)
|
||||
return lleg.rotationX;
|
||||
if(part == 5)
|
||||
return rleg.rotationX;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 head.rotationY;
|
||||
if(part == 1)
|
||||
return body.rotationY;
|
||||
if(part == 2)
|
||||
return larm.rotationY;
|
||||
if(part == 3)
|
||||
return rarm.rotationY;
|
||||
if(part == 4)
|
||||
return lleg.rotationY;
|
||||
if(part == 5)
|
||||
return rleg.rotationY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 head.rotationZ;
|
||||
if(part == 1)
|
||||
return body.rotationZ;
|
||||
if(part == 2)
|
||||
return larm.rotationZ;
|
||||
if(part == 3)
|
||||
return rarm.rotationZ;
|
||||
if(part == 4)
|
||||
return lleg.rotationZ;
|
||||
if(part == 5)
|
||||
return rleg.rotationZ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setOffset(int part, float offsetX, float offsetY, float offsetZ) {
|
||||
this.setOffsetX(part,offsetX);
|
||||
this.setOffsetY(part,offsetY);
|
||||
this.setOffsetZ(part,offsetZ);
|
||||
}
|
||||
|
||||
public void setOffsetX(int part, float offset) {
|
||||
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;
|
||||
}
|
||||
|
||||
public void setOffsetY(int part, float offset) {
|
||||
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;
|
||||
}
|
||||
|
||||
public void setOffsetZ(int part, float offset) {
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
this.getPart(i).setAnimRate(animRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,8 +52,8 @@ public class MixinModelRenderer {
|
||||
this.rotateAngleX = partConfigs[i].prevRotations[0];
|
||||
this.rotateAngleY = partConfigs[i].prevRotations[1];
|
||||
this.rotateAngleZ = partConfigs[i].prevRotations[2];
|
||||
this.setInterpolatedAngles(modelData,partConfigs[i]);
|
||||
this.addInterpolatedOffset(modelData,partConfigs[i]);
|
||||
this.setInterpolatedAngles(partConfigs[i]);
|
||||
this.addInterpolatedOffset(partConfigs[i]);
|
||||
partConfigs[i].prevRotations = new float[]{this.rotateAngleX, this.rotateAngleY, this.rotateAngleZ};
|
||||
}
|
||||
}
|
||||
@@ -118,72 +118,72 @@ public class MixinModelRenderer {
|
||||
return !puppetPart.disabled && this.partName.equals(partNames.get(puppetPart));
|
||||
}
|
||||
|
||||
public void setInterpolatedAngles(PlayerModelData modelData, JobPuppet.PartConfig puppetPart) {
|
||||
float pi = (float) Math.PI * (modelData.fullAngles ? 2 : 1);
|
||||
if (!modelData.animate) {
|
||||
this.rotateAngleX = puppetPart.rotationX * pi;
|
||||
this.rotateAngleY = puppetPart.rotationY * pi;
|
||||
this.rotateAngleZ = puppetPart.rotationZ * pi;
|
||||
} else if (puppetPart.partialRotationTick != ClientEventHandler.partialRenderTick) {
|
||||
puppetPart.partialRotationTick = ClientEventHandler.partialRenderTick;
|
||||
if (modelData.interpolate) {
|
||||
if (puppetPart.rotationX * pi - this.rotateAngleX != 0)
|
||||
this.rotateAngleX = (puppetPart.rotationX * pi - this.rotateAngleX) * modelData.animRate / 10f + this.rotateAngleX;
|
||||
if (puppetPart.rotationY * pi - this.rotateAngleY != 0)
|
||||
this.rotateAngleY = (puppetPart.rotationY * pi - this.rotateAngleY) * modelData.animRate / 10f + this.rotateAngleY;
|
||||
if (puppetPart.rotationZ * pi - this.rotateAngleZ != 0)
|
||||
this.rotateAngleZ = (puppetPart.rotationZ * pi - this.rotateAngleZ) * modelData.animRate / 10f + this.rotateAngleZ;
|
||||
public void setInterpolatedAngles(JobPuppet.PartConfig modelPart) {
|
||||
float pi = (float) Math.PI * (modelPart.fullAngles ? 2 : 1);
|
||||
if (!modelPart.animate) {
|
||||
this.rotateAngleX = modelPart.rotationX * pi;
|
||||
this.rotateAngleY = modelPart.rotationY * pi;
|
||||
this.rotateAngleZ = modelPart.rotationZ * pi;
|
||||
} else if (modelPart.partialRotationTick != ClientEventHandler.partialRenderTick) {
|
||||
modelPart.partialRotationTick = ClientEventHandler.partialRenderTick;
|
||||
if (modelPart.interpolate) {
|
||||
if (modelPart.rotationX * pi - this.rotateAngleX != 0)
|
||||
this.rotateAngleX = (modelPart.rotationX * pi - this.rotateAngleX) * modelPart.animRate / 10f + this.rotateAngleX;
|
||||
if (modelPart.rotationY * pi - this.rotateAngleY != 0)
|
||||
this.rotateAngleY = (modelPart.rotationY * pi - this.rotateAngleY) * modelPart.animRate / 10f + this.rotateAngleY;
|
||||
if (modelPart.rotationZ * pi - this.rotateAngleZ != 0)
|
||||
this.rotateAngleZ = (modelPart.rotationZ * pi - this.rotateAngleZ) * modelPart.animRate / 10f + this.rotateAngleZ;
|
||||
} else {
|
||||
int directionX = Float.compare(puppetPart.rotationX * pi, this.rotateAngleX);
|
||||
this.rotateAngleX += directionX * modelData.animRate / 10f;
|
||||
int directionX = Float.compare(modelPart.rotationX * pi, this.rotateAngleX);
|
||||
this.rotateAngleX += directionX * modelPart.animRate / 10f;
|
||||
this.rotateAngleX = directionX == 1 ?
|
||||
Math.min(puppetPart.rotationX * pi,this.rotateAngleX) : Math.max(puppetPart.rotationX * pi,this.rotateAngleX);
|
||||
int directionY = Float.compare(puppetPart.rotationY * pi, this.rotateAngleY);
|
||||
this.rotateAngleY += directionY * modelData.animRate / 10f;
|
||||
Math.min(modelPart.rotationX * pi,this.rotateAngleX) : Math.max(modelPart.rotationX * pi,this.rotateAngleX);
|
||||
int directionY = Float.compare(modelPart.rotationY * pi, this.rotateAngleY);
|
||||
this.rotateAngleY += directionY * modelPart.animRate / 10f;
|
||||
this.rotateAngleY = directionY == 1 ?
|
||||
Math.min(puppetPart.rotationY * pi,this.rotateAngleY) : Math.max(puppetPart.rotationY * pi,this.rotateAngleY);
|
||||
int directionZ = Float.compare(puppetPart.rotationZ * pi, this.rotateAngleZ);
|
||||
this.rotateAngleZ += directionZ * modelData.animRate / 10f;
|
||||
Math.min(modelPart.rotationY * pi,this.rotateAngleY) : Math.max(modelPart.rotationY * pi,this.rotateAngleY);
|
||||
int directionZ = Float.compare(modelPart.rotationZ * pi, this.rotateAngleZ);
|
||||
this.rotateAngleZ += directionZ * modelPart.animRate / 10f;
|
||||
this.rotateAngleZ = directionZ == 1 ?
|
||||
Math.min(puppetPart.rotationZ * pi,this.rotateAngleZ) : Math.max(puppetPart.rotationZ * pi,this.rotateAngleZ);
|
||||
Math.min(modelPart.rotationZ * pi,this.rotateAngleZ) : Math.max(modelPart.rotationZ * pi,this.rotateAngleZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addInterpolatedOffset(PlayerModelData modelData, JobPuppet.PartConfig puppetPart) {
|
||||
if (!puppetPart.setOriginalPivot) {
|
||||
puppetPart.setOriginalPivot = true;
|
||||
puppetPart.originalPivotX = this.rotationPointX;
|
||||
puppetPart.originalPivotY = this.rotationPointY;
|
||||
puppetPart.originalPivotZ = this.rotationPointZ;
|
||||
public void addInterpolatedOffset(JobPuppet.PartConfig modelPart) {
|
||||
if (!modelPart.setOriginalPivot) {
|
||||
modelPart.setOriginalPivot = true;
|
||||
modelPart.originalPivotX = this.rotationPointX;
|
||||
modelPart.originalPivotY = this.rotationPointY;
|
||||
modelPart.originalPivotZ = this.rotationPointZ;
|
||||
}
|
||||
|
||||
if (!modelData.animate) {
|
||||
this.rotationPointX = puppetPart.originalPivotX + puppetPart.pivotX;
|
||||
this.rotationPointY = puppetPart.originalPivotY + puppetPart.pivotY;
|
||||
this.rotationPointZ = puppetPart.originalPivotZ + puppetPart.pivotZ;
|
||||
} else if (puppetPart.partialPivotTick != ClientEventHandler.partialRenderTick) {
|
||||
puppetPart.partialPivotTick = ClientEventHandler.partialRenderTick;
|
||||
if (modelData.interpolate) {
|
||||
puppetPart.destPivotX = (puppetPart.pivotX - puppetPart.destPivotX) * modelData.animRate / 10f + puppetPart.destPivotX;
|
||||
this.rotationPointX = puppetPart.originalPivotX + puppetPart.destPivotX;
|
||||
puppetPart.destPivotY = (puppetPart.pivotY - puppetPart.destPivotY) * modelData.animRate / 10f + puppetPart.destPivotY;
|
||||
this.rotationPointY = puppetPart.originalPivotY + puppetPart.destPivotY;
|
||||
puppetPart.destPivotZ = (puppetPart.pivotZ - puppetPart.destPivotZ) * modelData.animRate / 10f + puppetPart.destPivotZ;
|
||||
this.rotationPointZ = puppetPart.originalPivotZ + puppetPart.destPivotZ;
|
||||
if (!modelPart.animate) {
|
||||
this.rotationPointX = modelPart.originalPivotX + modelPart.pivotX;
|
||||
this.rotationPointY = modelPart.originalPivotY + modelPart.pivotY;
|
||||
this.rotationPointZ = modelPart.originalPivotZ + modelPart.pivotZ;
|
||||
} else if (modelPart.partialPivotTick != ClientEventHandler.partialRenderTick) {
|
||||
modelPart.partialPivotTick = ClientEventHandler.partialRenderTick;
|
||||
if (modelPart.interpolate) {
|
||||
modelPart.destPivotX = (modelPart.pivotX - modelPart.destPivotX) * modelPart.animRate / 10f + modelPart.destPivotX;
|
||||
this.rotationPointX = modelPart.originalPivotX + modelPart.destPivotX;
|
||||
modelPart.destPivotY = (modelPart.pivotY - modelPart.destPivotY) * modelPart.animRate / 10f + modelPart.destPivotY;
|
||||
this.rotationPointY = modelPart.originalPivotY + modelPart.destPivotY;
|
||||
modelPart.destPivotZ = (modelPart.pivotZ - modelPart.destPivotZ) * modelPart.animRate / 10f + modelPart.destPivotZ;
|
||||
this.rotationPointZ = modelPart.originalPivotZ + modelPart.destPivotZ;
|
||||
} else {
|
||||
int directionX = Float.compare(puppetPart.pivotX, this.rotationPointX);
|
||||
this.rotationPointX = puppetPart.originalPivotX + directionX * modelData.animRate / 10f;
|
||||
int directionX = Float.compare(modelPart.pivotX, this.rotationPointX);
|
||||
this.rotationPointX = modelPart.originalPivotX + directionX * modelPart.animRate / 10f;
|
||||
this.rotationPointX = directionX == 1 ?
|
||||
Math.min(puppetPart.originalPivotX + puppetPart.pivotX,this.rotationPointX) : Math.max(puppetPart.originalPivotX + puppetPart.pivotX,this.rotationPointX);
|
||||
int directionY = Float.compare(puppetPart.pivotY, this.rotationPointY);
|
||||
this.rotationPointY = puppetPart.originalPivotY + directionY * modelData.animRate / 10f;
|
||||
Math.min(modelPart.originalPivotX + modelPart.pivotX,this.rotationPointX) : Math.max(modelPart.originalPivotX + modelPart.pivotX,this.rotationPointX);
|
||||
int directionY = Float.compare(modelPart.pivotY, this.rotationPointY);
|
||||
this.rotationPointY = modelPart.originalPivotY + directionY * modelPart.animRate / 10f;
|
||||
this.rotationPointY = directionY == 1 ?
|
||||
Math.min(puppetPart.originalPivotY + puppetPart.pivotY,this.rotationPointY) : Math.max(puppetPart.originalPivotY + puppetPart.pivotY,this.rotationPointY);
|
||||
int directionZ = Float.compare(puppetPart.pivotZ, this.rotationPointZ);
|
||||
this.rotationPointZ = puppetPart.originalPivotZ + directionZ * modelData.animRate / 10f;
|
||||
Math.min(modelPart.originalPivotY + modelPart.pivotY,this.rotationPointY) : Math.max(modelPart.originalPivotY + modelPart.pivotY,this.rotationPointY);
|
||||
int directionZ = Float.compare(modelPart.pivotZ, this.rotationPointZ);
|
||||
this.rotationPointZ = modelPart.originalPivotZ + directionZ * modelPart.animRate / 10f;
|
||||
this.rotationPointZ = directionZ == 1 ?
|
||||
Math.min(puppetPart.originalPivotZ + puppetPart.pivotZ,this.rotationPointZ) : Math.max(puppetPart.originalPivotZ + puppetPart.pivotZ,this.rotationPointZ);
|
||||
Math.min(modelPart.originalPivotZ + modelPart.pivotZ,this.rotationPointZ) : Math.max(modelPart.originalPivotZ + modelPart.pivotZ,this.rotationPointZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class MixinRenderPlayer {
|
||||
{
|
||||
if (Client.playerModelData.containsKey(p_77039_1_.getUniqueID())) {
|
||||
PlayerModelData data = Client.playerModelData.get(p_77039_1_.getUniqueID());
|
||||
if (data.enabled()) {
|
||||
if (data.enabled) {
|
||||
this.setInterpolatedAngles(data);
|
||||
if (data.rotationEnabledX) {
|
||||
GL11.glRotatef(data.modelRotations[0], 1, 0, 0);
|
||||
|
||||
@@ -79,14 +79,12 @@ public class JobPuppet extends JobInterface{
|
||||
public float pivotZ = 0f;
|
||||
|
||||
public boolean disabled = false;
|
||||
|
||||
// vvv Client-sided use vvv
|
||||
public boolean fullAngles = false;
|
||||
public boolean animate = false;
|
||||
public float animRate = 1.0F;
|
||||
public boolean interpolate = true;
|
||||
|
||||
//Client-sided use
|
||||
// vvv Client-sided use vvv
|
||||
public float[] prevRotations = new float[]{0,0,0};
|
||||
public float[] prevPivots = new float[]{0,0,0};
|
||||
|
||||
|
||||
Reference in new issue
Block a user