From 7f8246e04e06bfde08227c0ffa67a3092a39e6c1 Mon Sep 17 00:00:00 2001 From: luisc Date: Wed, 2 Mar 2022 18:18:03 -0600 Subject: [PATCH] PARTICLE ROTATION --- .../java/noppes/npcs/NoppesUtilServer.java | 10 +- .../java/noppes/npcs/client/NoppesUtil.java | 24 ++ .../noppes/npcs/client/fx/EntityCustomFX.java | 277 +++++++++--------- .../npcs/scripted/ScriptEntityParticle.java | 142 ++++++--- .../npcs/scripted/entity/ScriptEntity.java | 12 +- .../npcs/scripted/interfaces/IEntity.java | 34 ++- 6 files changed, 318 insertions(+), 181 deletions(-) diff --git a/src/main/java/noppes/npcs/NoppesUtilServer.java b/src/main/java/noppes/npcs/NoppesUtilServer.java index 6feca3dd1..91f1fc631 100644 --- a/src/main/java/noppes/npcs/NoppesUtilServer.java +++ b/src/main/java/noppes/npcs/NoppesUtilServer.java @@ -312,11 +312,15 @@ public class NoppesUtilServer { Server.sendAssociatedData(entity, EnumPacketClient.PARTICLE, entity.posX, entity.posY, entity.posZ, entity.height, entity.width, entity.yOffset, particle); } - public static void spawnScriptedParticle(Entity entity, String directory, int HEXcolor, int amount, int maxAge, + public static void spawnScriptedParticle(String directory, int HEXcolor, int amount, int maxAge, double x, double y, double z, 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, int entityID ){ Server.sendToAll(EnumPacketClient.SCRIPTED_PARTICLE, @@ -325,6 +329,10 @@ 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, entityID ); } diff --git a/src/main/java/noppes/npcs/client/NoppesUtil.java b/src/main/java/noppes/npcs/client/NoppesUtil.java index cfe3ce72e..a56100828 100644 --- a/src/main/java/noppes/npcs/client/NoppesUtil.java +++ b/src/main/java/noppes/npcs/client/NoppesUtil.java @@ -98,6 +98,26 @@ 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(); + int rotationXRateStart = buffer.readInt(); + + float rotationY1 = buffer.readFloat(); + float rotationY2 = buffer.readFloat(); + float rotationYRate = buffer.readFloat(); + int rotationYRateStart = buffer.readInt(); + + float rotationZ1 = buffer.readFloat(); + float rotationZ2 = buffer.readFloat(); + float rotationZRate = buffer.readFloat(); + int rotationZRateStart = buffer.readInt(); + int entityID = buffer.readInt(); World worldObj = Minecraft.getMinecraft().theWorld; @@ -113,6 +133,10 @@ 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, maxAge ); diff --git a/src/main/java/noppes/npcs/client/fx/EntityCustomFX.java b/src/main/java/noppes/npcs/client/fx/EntityCustomFX.java index 3ba3a02d6..f432ae0bd 100644 --- a/src/main/java/noppes/npcs/client/fx/EntityCustomFX.java +++ b/src/main/java/noppes/npcs/client/fx/EntityCustomFX.java @@ -7,7 +7,6 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import noppes.npcs.client.ClientProxy; -import org.lwjgl.Sys; import org.lwjgl.opengl.GL11; public class EntityCustomFX extends EntityFX { @@ -27,10 +26,38 @@ 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; + public float rotationXRate = 0.0F; + public int rotationXRateStart = 0; + + public float rotationY = 0; + public float rotationY1 = 0; + public float rotationY2 = 0; + public float rotationYRate = 0.0F; + public int rotationYRateStart = 0; + + public float rotationZ = 0; + public float rotationZ1 = 0; + public float rotationZ2 = 0; + public float rotationZRate = 0.0F; + public int rotationZRateStart = 0; + public EntityCustomFX(Entity entity, String directory, int HEXColor, double x, double y, double z, 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, int age) { super(entity.worldObj, x, y, z, motionX, motionY, motionZ); @@ -50,6 +77,38 @@ 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); + this.rotationXRateStart = rotationXRateStart; + rotationX = rotationX1; + if(rotationX1 > rotationX2) + this.rotationXRate *= -1; + + this.rotationY1 = rotationY1; + this.rotationY2 = rotationY2; + this.rotationYRate = Math.abs(rotationYRate); + this.rotationYRateStart = rotationYRateStart; + rotationY = rotationY1; + if(rotationY1 > rotationY2) + this.rotationYRate *= -1; + + this.rotationZ1 = rotationZ1; + this.rotationZ2 = rotationZ2; + this.rotationZRate = Math.abs(rotationZRate); + this.rotationZRateStart = rotationZRateStart; + rotationZ = rotationZ1; + if(rotationZ1 > rotationZ2) + this.rotationZRate *= -1; + particleGravity = gravity/0.04F; particleMaxAge = age; @@ -74,148 +133,96 @@ public class EntityCustomFX extends EntityFX { location = new ResourceLocation(directory); } - /* - par2 = partial tick time - par3 = ActiveRenderInfo.rotationX; - par4 = ActiveRenderInfo.rotationZ; - par5 = ActiveRenderInfo.rotationYZ; - par6 = ActiveRenderInfo.rotationXY; - par7 = ActiveRenderInfo.rotationXZ; - */ - @Override - public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) + public void renderParticle(Tessellator tessellator, float partialTick, float cosYaw, float cosPitch, float sinYaw, float sinSinPitch, float cosSinPitch) { - if(move){ - startX = (float)(entity.prevPosX + (entity.posX - entity.prevPosX) * (double)par2); - startY = (float)(entity.prevPosY + (entity.posY - entity.prevPosY) * (double)par2); - startZ = (float)(entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)par2); - } - Tessellator tessellator = Tessellator.instance; tessellator.draw(); - - float scale = this.scaleRate / (float)particleMaxAge; - if((this.scaleRate < 0 && particleScale+scale < this.scale2) || (this.scaleRate > 0 && particleScale+scale > this.scale2)) - particleScale = this.scale2; - else if(particleAge >= this.scaleRateStart) - particleScale += scale; - - float alpha = this.alphaRate / (float)particleMaxAge; - if((this.alphaRate < 0 && particleAlpha+alpha < this.alpha2) || (this.alphaRate > 0 && particleAlpha+alpha > this.alpha2)) - particleAlpha = this.alpha2; - else if(particleAge >= this.alphaRateStart) - particleAlpha += alpha; - - ClientProxy.bindTexture(location); - - float f = 0.0f; - float f1 = 1.0f; - float f2 = 0.0f; - float f3 = 1.0f; - float f4 = 0.1F * particleScale; - float f5 = (float)(((prevPosX + (posX - prevPosX) * (double)par2) - interpPosX) + startX); - float f6 = (float)(((prevPosY + (posY - prevPosY) * (double)par2) - interpPosY) + startY); - float f7 = (float)(((prevPosZ + (posZ - prevPosZ) * (double)par2) - interpPosZ) + startZ); - - tessellator.startDrawingQuads(); - tessellator.setBrightness(240); - par1Tessellator.setColorOpaque_F(1, 1, 1); - par1Tessellator.setColorRGBA_F(particleRed, particleGreen, particleBlue, particleAlpha); - par1Tessellator.addVertexWithUV(f5 - par3 * f4 - par6 * f4, f6 - par4 * f4, f7 - par5 * f4 - par7 * f4, f1, f3); - par1Tessellator.addVertexWithUV((f5 - par3 * f4) + par6 * f4, f6 + par4 * f4, (f7 - par5 * f4) + par7 * f4, f1, f2); - par1Tessellator.addVertexWithUV(f5 + par3 * f4 + par6 * f4, f6 + par4 * f4, f7 + par5 * f4 + par7 * f4, f, f2); - par1Tessellator.addVertexWithUV((f5 + par3 * f4) - par6 * f4, f6 - par4 * f4, (f7 + par5 * f4) - par7 * f4, f, f3); - - /* - Minecraft minecraft = Minecraft.getMinecraft(); - EntityPlayer player = minecraft.thePlayer; - - double angle = Minecraft.getMinecraft().theWorld.getWorldTime()%360; - double angleRad = (angle/180)*Math.PI; - - double diffX = player.posX - this.startX; - double diffY = player.posY - player.getYOffset() - this.startY; - double diffZ = player.posZ - this.startZ; - - double yaw = (player.rotationYaw/180)*Math.PI; - double pitch = (player.rotationPitch/180)*Math.PI; - - double angleX = Math.sin(yaw)*Math.cos(pitch); - if(Math.abs(angleX) < 0.0001){ - angleX = 0.0D; - } - double angleY = Math.sin(pitch); - if(Math.abs(angleY) < 0.0001){ - angleY = 0.0D; - } - double angleZ = -Math.cos(yaw)*Math.cos(pitch); - if(Math.abs(angleZ) < 0.0001){ - angleZ = 0.0D; - } - - double angleXtranslateX = 0.0D; - double angleXtranslateY = 0.0D;//(-diffY + Math.cos(angleRad)*diffY) + (-Math.sin(angleRad)*diffZ); - double angleXtranslateZ = 0.0D;//(Math.sin(angleRad)*diffY) + (-diffZ + Math.cos(angleRad)*diffZ); - - double angleYtranslateX = 0.0D;//(-diffX + Math.cos(angleRad)*diffX) + (Math.sin(angleRad)*diffZ); - double angleYtranslateY = 0.0D; - double angleYtranslateZ = 0.0D;//(-Math.sin(angleRad)*diffX) + (-diffZ + Math.cos(angleRad)*diffZ); - - double angleZtranslateX = 0.0D;//(-diffX + Math.cos(angleRad)*diffX) + (-Math.sin(angleRad)*diffY); - double angleZtranslateY = 0.0D;//(Math.sin(angleRad)*diffX) + (-diffY + Math.cos(angleRad)*diffY); - double angleZtranslateZ = 0.0D; - - double translateX = angleXtranslateX + angleYtranslateX + angleZtranslateX; - double translateY = angleXtranslateY + angleYtranslateY + angleZtranslateY; - double translateZ = angleXtranslateZ + angleYtranslateZ + angleZtranslateZ; - - //distance in the X & Z plane - double distXZ = Math.sqrt(Math.pow(diffX,2) + Math.pow(diffZ,2)); - //distance in the X & Y plane - double distXY = Math.sqrt(Math.pow(diffX,2) + Math.pow(diffY,2)); - //distance in the Y & Z plane - double distYZ = Math.sqrt(Math.pow(diffY,2) + Math.pow(diffZ,2)); - - double signDiffX = Math.signum(diffX); - double signDiffY = Math.signum(diffY); - double signDiffZ = Math.signum(diffZ); - - double angleXtoNorm = Math.sin(Math.acos(diffX/distXZ)); - double angleZtoNorm = Math.sin(Math.acos(diffZ/distXZ)); - - double angleDiffX = (Math.abs(Math.cos(yaw))-angleXtoNorm); - double angleDiffZ = (Math.abs(Math.cos(yaw))-angleZtoNorm); - - double translateX = -Math.abs(angleDiffX*angleZ*distXZ)*signDiffX; - double translateY = 0; - double translateZ = -Math.abs(angleDiffX*angleX*distXZ)*signDiffZ + Math.cos(angleRad)*Math.abs(angleDiffX*angleX*distXZ)*signDiffZ; - - if(minecraft.currentScreen == null) { - System.out.println(); - //System.out.printf("diffX: %f, diffY: %f, diffZ: %f\n", diffX, diffY, diffZ); - //System.out.printf("angleX: %f, angleY: %f, angleZ: %f\n", angleX, angleY, angleZ); - //System.out.printf("angleXtoNorm: %f, angleZtoNorm: %f\n", angleXtoNorm, angleZtoNorm); - System.out.printf("Math.sin(yaw): %f\n", Math.sin(yaw)); - System.out.printf("Math.cos(yaw): %f\n", Math.cos(yaw)); - //System.out.printf("Math.sin(pitch): %f\n", Math.sin(pitch)); - //System.out.printf("Math.cos(pitch): %f\n", Math.cos(pitch)); - System.out.printf("angleDiffX: %f\n", angleDiffX); - System.out.printf("angleDiffZ: %f\n", angleDiffZ); - System.out.printf("translateX: %f\n", Math.cos(angleRad)*Math.abs(angleDiffX*angleZ*distXZ)*signDiffX); - System.out.printf("translateZ: %f\n", Math.cos(angleRad)*Math.abs(angleDiffX*angleX*distXZ)*signDiffZ); - } - */ - GL11.glPushMatrix(); - GL11.glColor4f(1, 1, 1, 1.0F); + ClientProxy.bindTexture(location); + GL11.glTexParameterf(3553, 10242, 10497.0F); + GL11.glTexParameterf(3553, 10243, 10497.0F); + GL11.glDisable(2884); + GL11.glEnable(3042); - //GL11.glTranslated(translateX,translateY,translateZ); - //GL11.glRotated(angle, angleX, angleY, angleZ); + if(move){ + startX = (float)(entity.prevPosX + (entity.posX - entity.prevPosX) * (double)partialTick); + startY = (float)(entity.prevPosY + (entity.posY - entity.prevPosY) * (double)partialTick); + startZ = (float)(entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)partialTick); + } + + float scaleChange = this.scaleRate / (float)particleMaxAge; + if((this.scaleRate < 0 && particleScale+scaleChange < this.scale2) || (this.scaleRate > 0 && particleScale+scaleChange > this.scale2)) + particleScale = this.scale2; + else if(particleAge >= this.scaleRateStart) + particleScale += scaleChange; + + float alphaChange = this.alphaRate / (float)particleMaxAge; + if((this.alphaRate < 0 && particleAlpha+alphaChange < this.alpha2) || (this.alphaRate > 0 && particleAlpha+alphaChange > this.alpha2)) + particleAlpha = this.alpha2; + 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; + else if(particleAge >= this.rotationXRateStart) + rotationX += rotationXChange; + + float rotationYChange = this.rotationYRate / (float)particleMaxAge; + if((this.rotationYRate < 0 && rotationY+rotationYChange < this.rotationY2) || (this.rotationYRate > 0 && rotationY+rotationYChange > this.rotationY2)) + rotationY = this.rotationY2; + else if(particleAge >= this.rotationYRateStart) + rotationY += rotationYChange; + + float rotationZChange = this.rotationZRate / (float)particleMaxAge; + if((this.rotationZRate < 0 && rotationZ+rotationZChange < this.rotationZ2) || (this.rotationZRate > 0 && rotationZ+rotationZChange > this.rotationZ2)) + rotationZ = this.rotationZ2; + else if(particleAge >= this.rotationZRateStart) + rotationZ += rotationZChange; + + float u1 = 0.0f; + float u2 = 1.0f; + float v1 = 0.0f; + float v2 = 1.0f; + + float renderScale = 0.1F * particleScale; + + float posX = (float)(((prevPosX + (this.posX - prevPosX) * (double)partialTick) - interpPosX) + startX); + float posY = (float)(((prevPosY + (this.posY - prevPosY) * (double)partialTick) - interpPosY) + startY); + float posZ = (float)(((prevPosZ + (this.posZ - prevPosZ) * (double)partialTick) - interpPosZ) + startZ); + + GL11.glTranslated((double)posX, (double)posY, (double)posZ); + + EntityPlayer player = Minecraft.getMinecraft().thePlayer; + 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); + + tessellator.startDrawingQuads(); + tessellator.setBrightness(240); + tessellator.setColorOpaque_F(1, 1, 1); + tessellator.setColorRGBA_F(particleRed, particleGreen, particleBlue, particleAlpha); + tessellator.addVertexWithUV( - cosYaw * renderScale - sinSinPitch * renderScale, - cosPitch * renderScale, - sinYaw * renderScale - cosSinPitch * renderScale, u2, v2); + tessellator.addVertexWithUV(( - cosYaw * renderScale) + sinSinPitch * renderScale, + cosPitch * renderScale, ( - sinYaw * renderScale) + cosSinPitch * renderScale, u2, v1); + tessellator.addVertexWithUV( + cosYaw * renderScale + sinSinPitch * renderScale, + cosPitch * renderScale, + sinYaw * renderScale + cosSinPitch * renderScale, u1, v1); + tessellator.addVertexWithUV(( + cosYaw * renderScale) - sinSinPitch * renderScale, - cosPitch * renderScale, ( + sinYaw * renderScale) - cosSinPitch * renderScale, u1, v2); tessellator.draw(); - ClientProxy.bindTexture(resource); - tessellator.startDrawingQuads(); GL11.glPopMatrix(); + + GL11.glColor4f(1, 1, 1, 1.0F); + ClientProxy.bindTexture(resource); + tessellator.startDrawingQuads(); } public int getFXLayer(){ diff --git a/src/main/java/noppes/npcs/scripted/ScriptEntityParticle.java b/src/main/java/noppes/npcs/scripted/ScriptEntityParticle.java index bc7e15120..63560c784 100644 --- a/src/main/java/noppes/npcs/scripted/ScriptEntityParticle.java +++ b/src/main/java/noppes/npcs/scripted/ScriptEntityParticle.java @@ -18,17 +18,45 @@ public class ScriptEntityParticle { private float alpha1 = 1.0f,alpha2 = 1.0f,alphaRate = 0.0f; private int scaleRateStart = 0, 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; + public float rotationXRate = 0.0F; + public int rotationXRateStart = 0; + + public float rotationY = 0; + public float rotationY1 = 0; + public float rotationY2 = 0; + public float rotationYRate = 0.0F; + public int rotationYRateStart = 0; + + public float rotationZ = 0; + public float rotationZ1 = 0; + public float rotationZ2 = 0; + public float rotationZRate = 0.0F; + public int rotationZRateStart = 0; + public ScriptEntityParticle(String directory){ this.directory = directory; } public void spawnOnEntity(ScriptEntity entity){ int entityID = entity.getMCEntity().getEntityId(); - NoppesUtilServer.spawnScriptedParticle(entity.getMCEntity(), directory, HEXcolor, amount, maxAge, + NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge, x, y, z, 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, entityID ); } @@ -52,11 +80,9 @@ public class ScriptEntityParticle { public double getX() { return x; } - public double getY() { return y; } - public double getZ() { return z; } @@ -64,50 +90,61 @@ public class ScriptEntityParticle { public double getMotionX() { return motionX; } - public double getMotionY() { return motionY; } - public double getMotionZ() { return motionZ; } - public float getGravity() { return gravity; } - public float getScale1() { - return scale1; - } - - public float getScale2() { - return scale2; - } - - public float getScaleRate() { - return scaleRate; - } - public float getAlpha1() { return alpha1; } - public float getAlpha2() { return alpha2; } - public float getAlphaRate() { return alphaRate; } + public int getAlphaRateStart() { + return alphaRateStart; + } + public float getScale1() { + return scale1; + } + public float getScale2() { + return scale2; + } + public float getScaleRate() { + return scaleRate; + } public int getScaleRateStart() { return scaleRateStart; } - public int getAlphaRateStart() { - return alphaRateStart; - } + 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;} + public int getRotationXRateStart() {return rotationXRateStart;} + + public float getRotationY1() {return rotationY1;} + public float getRotationY2() {return rotationY2;} + public float getRotationYRate() {return rotationYRate;} + public int getRotationYRateStart() {return rotationYRateStart;} + + public float getRotationZ1() {return rotationZ1;} + public float getRotationZ2() {return rotationZ2;} + public float getRotationZRate() {return rotationZRate;} + public int getRotationZRateStart() {return rotationZRateStart;} public void setDirectory(String directory) { this.directory = directory; @@ -130,15 +167,12 @@ public class ScriptEntityParticle { this.y = y; this.z = z; } - public void setX(double x) { this.x = x; } - public void setY(double y) { this.y = y; } - public void setZ(double z) { this.z = z; } @@ -149,19 +183,15 @@ public class ScriptEntityParticle { this.motionZ = motionZ; this.gravity = gravity; } - public void setMotionX(double motionX) { this.motionX = motionX; } - public void setMotionY(double motionY) { this.motionY = motionY; } - public void setMotionZ(double motionZ) { this.motionZ = motionZ; } - public void setGravity(float gravity) { this.gravity = gravity; } @@ -172,19 +202,15 @@ public class ScriptEntityParticle { this.scaleRate = scaleRate; this.scaleRateStart = scaleRateStart; } - public void setScale1(float scale1) { this.scale1 = scale1; } - public void setScale2(float scale2) { this.scale2 = scale2; } - public void setScaleRate(float scaleRate) { this.scaleRate = scaleRate; } - public void setScaleRateStart(int scaleRateStart) { this.scaleRateStart = scaleRateStart; } @@ -195,20 +221,60 @@ public class ScriptEntityParticle { this.alphaRate = alphaRate; this.alphaRateStart = alphaRateStart; } - public void setAlpha1(float alpha1) { this.alpha1 = alpha1; } - public void setAlpha2(float alpha2) { this.alpha2 = alpha2; } - public void setAlphaRate(float alphaRate) { this.alphaRate = alphaRate; } - public void setAlphaRateStart(int alphaRateStart) { 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; + this.rotationXRate = rotationXRate; + this.rotationXRateStart = rotationXRateStart; + } + public void setRotationX1(float rotationX1) {this.rotationX1 = rotationX1;} + public void setRotationX2(float rotationX2) {this.rotationX2 = rotationX2;} + public void setRotationXRate(float rotationXRate) {this.rotationXRate = rotationXRate;} + public void setRotationXRateStart(int rotationXRateStart) {this.rotationXRateStart = rotationXRateStart;} + + public void setRotationY(float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart){ + this.rotationY1 = rotationY1; + this.rotationY2 = rotationY2; + this.rotationYRate = rotationYRate; + this.rotationYRateStart = rotationYRateStart; + } + public void setRotationY1(float rotationY1) {this.rotationY1 = rotationY1;} + public void setRotationY2(float rotationY2) {this.rotationY2 = rotationY2;} + public void setRotationYRate(float rotationYRate) {this.rotationYRate = rotationYRate;} + public void setRotationYRateStart(int rotationYRateStart) {this.rotationYRateStart = rotationYRateStart;} + + public void setRotationZ(float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart){ + this.rotationZ1 = rotationZ1; + this.rotationZ2 = rotationZ2; + this.rotationZRate = rotationZRate; + this.rotationZRateStart = rotationZRateStart; + } + public void setRotationZ1(float rotationZ1) {this.rotationZ1 = rotationZ1;} + public void setRotationZ2(float rotationZ2) {this.rotationZ2 = rotationZ2;} + public void setRotationZRate(float rotationZRate) {this.rotationZRate = rotationZRate;} + public void setRotationZRateStart(int rotationZRateStart) {this.rotationZRateStart = rotationZRateStart;} } diff --git a/src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java b/src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java index dab54f511..b284701f0 100644 --- a/src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java +++ b/src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java @@ -67,14 +67,22 @@ public class ScriptEntity implements IEntity { double x, double y, double z, 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 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 ) { int entityID = entity.getEntityId(); - NoppesUtilServer.spawnScriptedParticle(entity, directory, HEXcolor, amount, maxAge, + NoppesUtilServer.spawnScriptedParticle(directory, HEXcolor, amount, maxAge, x, y, z, 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, entityID ); } diff --git a/src/main/java/noppes/npcs/scripted/interfaces/IEntity.java b/src/main/java/noppes/npcs/scripted/interfaces/IEntity.java index 27cdbc218..a806676d9 100644 --- a/src/main/java/noppes/npcs/scripted/interfaces/IEntity.java +++ b/src/main/java/noppes/npcs/scripted/interfaces/IEntity.java @@ -34,12 +34,36 @@ public interface IEntity { * @param alpha2 The particle's ending transparency * @param scaleRate Multiplier for the particle's transparency growth rate * @param alphaRateStart The time at which the particle begins appearing/fading + * + * @param rotation1 The particle's starting rotation angle with respect to the player's vision + * @param rotation2 The particle's final rotation angle with respect to the player's vision + * @param rotationRate The rate at which the particle rotates with respect to the player's vision + * @param rotationRateStart The time at which the particle begins rotating + + * @param rotationX1 The particle's starting rotation angle with respect to the X-axis + * @param rotationX2 The particle's final rotation angle with respect to the X-axis + * @param rotationXRate The rate at which the particle rotates with respect to the X-axis + * @param rotationXRateStart The time at which the particle begins rotating over the X-axis + + * @param rotationY1 The particle's starting rotation angle with respect to the Y-axis + * @param rotationY2 The particle's final rotation angle with respect to the Y-axis + * @param rotationYRate The rate at which the particle rotates with respect to the Y-axis + * @param rotationYRateStart The time at which the particle begins rotating over the Y-axis + + * @param rotationZ1 The particle's starting rotation angle with respect to the Z-axis + * @param rotationZ2 The particle's final rotation angle with respect to the Z-axis + * @param rotationZRate The rate at which the particle rotates with respect to the Z-axis + * @param rotationZRateStart The time at which the particle begins rotating over the Z-axis */ - public void spawnParticle(String directory, int HEXcolor, int amount, int maxAge, - double x, double y, double z, - double motionX, double motionY, double motionZ, float gravity, - float scale1, float scale2, float scaleRate, int scaleRateStart, - float alpha1, float alpha2, float alphaRate, int alphaRateStart + void spawnParticle(String directory, int HEXcolor, int amount, int maxAge, + double x, double y, double z, + 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 ); public double getYOffset();