mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 16:59:43 +00:00
Implemented XYZ rotations correctly, now clearly rotate around an axis respective to the player's camera.
This commit is contained in:
1 parent
75b7c01f87
commit
1cb27a9e7a
6 files changed
+10
-58
No files matched your search
@@ -317,7 +317,6 @@ public class NoppesUtilServer {
|
||||
double motionX, double motionY, double motionZ, float gravity,
|
||||
float scale1, float scale2, float scaleRate, int scaleRateStart,
|
||||
float alpha1, float alpha2, float alphaRate, int alphaRateStart,
|
||||
float rotation1, float rotation2, float rotationRate, int rotationRateStart,
|
||||
float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart,
|
||||
float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart,
|
||||
float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart,
|
||||
@@ -329,7 +328,6 @@ public class NoppesUtilServer {
|
||||
motionX, motionY, motionZ, gravity,
|
||||
scale1, scale2, scaleRate, scaleRateStart,
|
||||
alpha1, alpha2, alphaRate, alphaRateStart,
|
||||
rotation1, rotation2, rotationRate, rotationRateStart,
|
||||
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
|
||||
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
|
||||
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
|
||||
|
||||
@@ -98,11 +98,6 @@ public class NoppesUtil {
|
||||
float alphaRate = buffer.readFloat();
|
||||
int alphaRateStart = buffer.readInt();
|
||||
|
||||
float rotation1 = buffer.readFloat();
|
||||
float rotation2 = buffer.readFloat();
|
||||
float rotationRate = buffer.readFloat();
|
||||
int rotationRateStart = buffer.readInt();
|
||||
|
||||
float rotationX1 = buffer.readFloat();
|
||||
float rotationX2 = buffer.readFloat();
|
||||
float rotationXRate = buffer.readFloat();
|
||||
@@ -133,7 +128,6 @@ public class NoppesUtil {
|
||||
motionX, motionY, motionZ, gravity,
|
||||
scale1, scale2, scaleRate, scaleRateStart,
|
||||
alpha1, alpha2, alphaRate, alphaRateStart,
|
||||
rotation1, rotation2, rotationRate, rotationRateStart,
|
||||
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
|
||||
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
|
||||
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
|
||||
|
||||
@@ -26,12 +26,6 @@ public class EntityCustomFX extends EntityFX {
|
||||
public float alphaRate = 0.0F;
|
||||
public int alphaRateStart = 0;
|
||||
|
||||
public float rotation = 0;
|
||||
public float rotation1 = 0;
|
||||
public float rotation2 = 0;
|
||||
public float rotationRate = 0.0F;
|
||||
public int rotationRateStart = 0;
|
||||
|
||||
public float rotationX = 0;
|
||||
public float rotationX1 = 0;
|
||||
public float rotationX2 = 0;
|
||||
@@ -54,7 +48,6 @@ public class EntityCustomFX extends EntityFX {
|
||||
double motionX, double motionY, double motionZ, float gravity,
|
||||
float scale1, float scale2, float scaleRate, int scaleRateStart,
|
||||
float alpha1, float alpha2, float alphaRate, int alphaRateStart,
|
||||
float rotation1, float rotation2, float rotationRate, int rotationRateStart,
|
||||
float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart,
|
||||
float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart,
|
||||
float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart,
|
||||
@@ -77,14 +70,6 @@ public class EntityCustomFX extends EntityFX {
|
||||
if(alpha1 > alpha2)
|
||||
this.alphaRate *= -1;
|
||||
|
||||
this.rotation1 = rotation1;
|
||||
this.rotation2 = rotation2;
|
||||
this.rotationRate = Math.abs(rotationRate);
|
||||
this.rotationRateStart = rotationRateStart;
|
||||
rotation = rotation1;
|
||||
if(rotation1 > rotation2)
|
||||
this.rotationRate *= -1;
|
||||
|
||||
this.rotationX1 = rotationX1;
|
||||
this.rotationX2 = rotationX2;
|
||||
this.rotationXRate = Math.abs(rotationXRate);
|
||||
@@ -158,12 +143,6 @@ public class EntityCustomFX extends EntityFX {
|
||||
else if(particleAge >= this.alphaRateStart)
|
||||
particleAlpha += alphaChange;
|
||||
|
||||
float rotationChange = this.rotationRate / (float)particleMaxAge;
|
||||
if((this.rotationRate < 0 && rotation+rotationChange < this.rotation2) || (this.rotationRate > 0 && rotation+rotationChange > this.rotation2))
|
||||
rotation = this.rotation2;
|
||||
else if(particleAge >= this.rotationRateStart)
|
||||
rotation += rotationChange;
|
||||
|
||||
float rotationXChange = this.rotationXRate / (float)particleMaxAge;
|
||||
if((this.rotationXRate < 0 && rotationX+rotationXChange < this.rotationX2) || (this.rotationXRate > 0 && rotationX+rotationXChange > this.rotationX2))
|
||||
rotationX = this.rotationX2;
|
||||
@@ -199,10 +178,16 @@ public class EntityCustomFX extends EntityFX {
|
||||
double yaw = (player.rotationYaw/180)*Math.PI;
|
||||
double pitch = (player.rotationPitch/180)*Math.PI;
|
||||
|
||||
GL11.glRotated(rotation, Math.sin(yaw)*Math.cos(pitch), Math.sin(pitch), -Math.cos(yaw)*Math.cos(pitch));
|
||||
GL11.glRotated(rotationX, 1.0,0.0,0.0);
|
||||
GL11.glRotated(rotationY, 0.0,1.0,0.0);
|
||||
GL11.glRotated(rotationZ, 0.0,0.0,1.0);
|
||||
if(Math.abs(rotationX%360) >= 90 && Math.abs(rotationX%360) < 270) {
|
||||
rotationX += 180*Math.signum(rotationX);
|
||||
}
|
||||
if(Math.abs(rotationY%360) >= 90 && Math.abs(rotationY%360) < 270) {
|
||||
rotationY += 180*Math.signum(rotationY);
|
||||
}
|
||||
|
||||
GL11.glRotated(rotationX, Math.cos(yaw)*Math.cos(pitch),0.0,Math.sin(yaw)*Math.cos(pitch));
|
||||
GL11.glRotated(rotationY, -Math.sin(yaw)*Math.sin(pitch), Math.cos(pitch), Math.cos(yaw)*Math.sin(pitch));
|
||||
GL11.glRotated(rotationZ, Math.sin(yaw)*Math.cos(pitch), Math.sin(pitch), -Math.cos(yaw)*Math.cos(pitch));
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setBrightness(240);
|
||||
|
||||
@@ -163,8 +163,6 @@ public class GuiNpcPuppet extends GuiModelInterface implements ISliderListener{
|
||||
}
|
||||
if(btn.id == 170 || btn.id == 171 || btn.id == 172){
|
||||
if(btn.id == 170){
|
||||
System.out.println(part.rotationX);
|
||||
System.out.println(rotateX.sliderValue);
|
||||
part.rotationX = 0.0f;
|
||||
rotateX.sliderValue = 0.5f;
|
||||
int percent = (int) ((rotateX.sliderValue) * 360);
|
||||
|
||||
@@ -18,11 +18,6 @@ public class ScriptEntityParticle {
|
||||
private float alpha1 = 1.0f,alpha2 = 1.0f,alphaRate = 0.0f;
|
||||
private int scaleRateStart = 0, alphaRateStart = 0;
|
||||
|
||||
public float rotation1 = 0;
|
||||
public float rotation2 = 0;
|
||||
public float rotationRate = 0.0F;
|
||||
public int rotationRateStart = 0;
|
||||
|
||||
public float rotationX1 = 0;
|
||||
public float rotationX2 = 0;
|
||||
public float rotationXRate = 0.0F;
|
||||
@@ -49,7 +44,6 @@ public class ScriptEntityParticle {
|
||||
motionX, motionY, motionZ, gravity,
|
||||
scale1, scale2, scaleRate, scaleRateStart,
|
||||
alpha1, alpha2, alphaRate, alphaRateStart,
|
||||
rotation1, rotation2, rotationRate, rotationRateStart,
|
||||
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
|
||||
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
|
||||
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
|
||||
@@ -122,11 +116,6 @@ public class ScriptEntityParticle {
|
||||
return scaleRateStart;
|
||||
}
|
||||
|
||||
public float getRotation1() {return rotation1;}
|
||||
public float getRotation2() {return rotation2;}
|
||||
public float getRotationRate() {return rotationRate;}
|
||||
public int getRotationRateStart() {return rotationRateStart;}
|
||||
|
||||
public float getRotationX1() {return rotationX1;}
|
||||
public float getRotationX2() {return rotationX2;}
|
||||
public float getRotationXRate() {return rotationXRate;}
|
||||
@@ -230,17 +219,6 @@ public class ScriptEntityParticle {
|
||||
this.alphaRateStart = alphaRateStart;
|
||||
}
|
||||
|
||||
public void setRotation(float rotation1, float rotation2, float rotationRate, int rotationRateStart){
|
||||
this.rotation1 = rotation1;
|
||||
this.rotation2 = rotation2;
|
||||
this.rotationRate = rotationRate;
|
||||
this.rotationRateStart = rotationRateStart;
|
||||
}
|
||||
public void setRotation1(float rotation1) {this.rotation1 = rotation1;}
|
||||
public void setRotation2(float rotation2) {this.rotation2 = rotation2;}
|
||||
public void setRotationRate(float rotationRate) {this.rotationRate = rotationRate;}
|
||||
public void setRotationRateStart(int rotationRateStart) {this.rotationRateStart = rotationRateStart;}
|
||||
|
||||
public void setRotationX(float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart){
|
||||
this.rotationX1 = rotationX1;
|
||||
this.rotationX2 = rotationX2;
|
||||
|
||||
@@ -79,7 +79,6 @@ public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
motionX, motionY, motionZ, gravity,
|
||||
scale1, scale2, scaleRate, scaleRateStart,
|
||||
alpha1, alpha2, alphaRate, alphaRateStart,
|
||||
rotation1, rotation2, rotationRate, rotationRateStart,
|
||||
rotationX1, rotationX2, rotationXRate, rotationXRateStart,
|
||||
rotationY1, rotationY2, rotationYRate, rotationYRateStart,
|
||||
rotationZ1, rotationZ2, rotationZRate, rotationZRateStart,
|
||||
|
||||
Reference in new issue
Block a user