diff --git a/src/main/java/noppes/npcs/NoppesUtilServer.java b/src/main/java/noppes/npcs/NoppesUtilServer.java index 278878640..ba4c50d5f 100644 --- a/src/main/java/noppes/npcs/NoppesUtilServer.java +++ b/src/main/java/noppes/npcs/NoppesUtilServer.java @@ -320,7 +320,8 @@ public class NoppesUtilServer { float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart, float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart, float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart, - boolean facePlayer, int width, int height, int offsetX, int offsetY, int animRate, + boolean facePlayer, int width, int height, int offsetX, int offsetY, + int animRate, boolean animLoop, int animStart, int animEnd, int entityID ){ Server.sendToAll(EnumPacketClient.SCRIPTED_PARTICLE, @@ -332,7 +333,8 @@ public class NoppesUtilServer { rotationX1, rotationX2, rotationXRate, rotationXRateStart, rotationY1, rotationY2, rotationYRate, rotationYRateStart, rotationZ1, rotationZ2, rotationZRate, rotationZRateStart, - facePlayer, width, height, offsetX, offsetY, animRate, + facePlayer, width, height, offsetX, offsetY, + animRate, animLoop, animStart, animEnd, entityID ); } diff --git a/src/main/java/noppes/npcs/client/NoppesUtil.java b/src/main/java/noppes/npcs/client/NoppesUtil.java index 3b2d1f27a..5552bbea3 100644 --- a/src/main/java/noppes/npcs/client/NoppesUtil.java +++ b/src/main/java/noppes/npcs/client/NoppesUtil.java @@ -119,7 +119,11 @@ public class NoppesUtil { int height = buffer.readInt(); int offsetX = buffer.readInt(); int offsetY = buffer.readInt(); + int animRate = buffer.readInt(); + boolean animLoop = buffer.readBoolean(); + int animStart = buffer.readInt(); + int animEnd = buffer.readInt(); int entityID = buffer.readInt(); @@ -140,7 +144,8 @@ public class NoppesUtil { rotationY1, rotationY2, rotationYRate, rotationYRateStart, rotationZ1, rotationZ2, rotationZRate, rotationZRateStart, maxAge, facePlayer, - width, height, offsetX, offsetY, animRate + width, height, offsetX, offsetY, + animRate, animLoop, animStart, animEnd ); for(int i = 0; i < amount; i++){ diff --git a/src/main/java/noppes/npcs/client/fx/EntityCustomFX.java b/src/main/java/noppes/npcs/client/fx/EntityCustomFX.java index 421c4da14..0fb47c7d2 100644 --- a/src/main/java/noppes/npcs/client/fx/EntityCustomFX.java +++ b/src/main/java/noppes/npcs/client/fx/EntityCustomFX.java @@ -65,8 +65,10 @@ public class EntityCustomFX extends EntityFX { private int timeSinceStart; public int animRate; - public int animPosX; - public int animPosY; + public boolean animLoop; + public int animStart,animEnd; + private int animPosX; + private int animPosY; private ImageDownloadAlt imageDownloadAlt = null; private boolean isUrl = false; @@ -79,7 +81,9 @@ public class EntityCustomFX extends EntityFX { 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, boolean facePlayer, int width, int height, int offsetX, int offsetY, int animRate) { + int age, boolean facePlayer, int width, int height, int offsetX, int offsetY, + int animRate, boolean animLoop, int animStart, int animEnd + ) { super(entity.worldObj, x, y, z, motionX, motionY, motionZ); this.scale1 = scale1; @@ -149,7 +153,13 @@ public class EntityCustomFX extends EntityFX { this.height = height; this.offsetX = offsetX; this.offsetY = offsetY; + this.animRate = animRate; + this.animLoop = animLoop; + this.animStart = animStart; + this.animEnd = animEnd; + if(this.animEnd < this.animStart) + this.animEnd = this.animStart + this.particleMaxAge; if(directory.startsWith("https://")){ isUrl = true; @@ -183,12 +193,12 @@ public class EntityCustomFX extends EntityFX { this.motionY -= 0.04D * (double)this.particleGravity; this.moveEntity(this.motionX, this.motionY, this.motionZ); - if(animRate > 0 && timeSinceStart%animRate == 0 && timeSinceStart > 0 && gotWidthHeight){ + if(animRate > 0 && timeSinceStart%animRate == 0 && timeSinceStart > 0 && gotWidthHeight && timeSinceStart >= animStart && timeSinceStart <= animEnd && (animLoop || animPosY <= totalHeight)){ animPosX += width; - if(animPosX + width > totalWidth) { + if (animPosX + width > totalWidth) { animPosX = offsetX; animPosY += height; - if(animPosY > totalHeight) { + if (animPosY > totalHeight && animLoop) { animPosY = offsetY; } } diff --git a/src/main/java/noppes/npcs/scripted/ScriptEntityParticle.java b/src/main/java/noppes/npcs/scripted/ScriptEntityParticle.java index af51270e4..3a403d9d3 100644 --- a/src/main/java/noppes/npcs/scripted/ScriptEntityParticle.java +++ b/src/main/java/noppes/npcs/scripted/ScriptEntityParticle.java @@ -35,7 +35,10 @@ public class ScriptEntityParticle { public int width = -1, height = -1; public int offsetX = 0, offsetY = 0; + public int animRate = 0; + public boolean animLoop = true; + public int animStart = 0, animEnd = -1; public boolean facePlayer = true; @@ -53,7 +56,8 @@ public class ScriptEntityParticle { rotationX1, rotationX2, rotationXRate, rotationXRateStart, rotationY1, rotationY2, rotationYRate, rotationYRateStart, rotationZ1, rotationZ2, rotationZRate, rotationZRateStart, - facePlayer, width, height, offsetX, offsetY, animRate, + facePlayer, width, height, offsetX, offsetY, + animRate, animLoop, animStart, animEnd, entityID ); } @@ -72,8 +76,20 @@ public class ScriptEntityParticle { public int getOffsetX() { return offsetX; } public int getOffsetY() { return offsetY; } + public void setAnim(int animRate, boolean animLoop, int animStart, int animEnd){ + this.animRate = animRate; + this.animLoop = animLoop; + this.animStart = animStart; + this.animEnd = animEnd; + } public void setAnimRate(int animRate) { this.animRate = animRate; } public int getAnimRate() { return animRate; } + public void setAnimLoop(boolean animLoop) { this.animLoop = animLoop; } + public boolean getAnimLoop() { return animLoop; } + public void setAnimStart(int animStart) { this.animStart = animStart; } + public int getAnimStart() { return animStart; } + public void setAnimEnd(int animEnd) { this.animEnd = animEnd; } + public int getAnimEnd() { return animEnd; } public boolean getFacePlayer() { return facePlayer; } public void setFacePlayer(boolean facePlayer) { this.facePlayer = facePlayer; } diff --git a/src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java b/src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java index 8a83eb4ac..6fe0faa58 100644 --- a/src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java +++ b/src/main/java/noppes/npcs/scripted/entity/ScriptEntity.java @@ -82,7 +82,8 @@ public class ScriptEntity implements IEntity { rotationX1, rotationX2, rotationXRate, rotationXRateStart, rotationY1, rotationY2, rotationYRate, rotationYRateStart, rotationZ1, rotationZ2, rotationZRate, rotationZRateStart, - true, -1, -1, 0,0, 0, + true, -1, -1, 0,0, + 0, true, 0, 0, entityID ); } @@ -101,7 +102,8 @@ public class ScriptEntity implements IEntity { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - true, -1, -1, 0,0,0, + true, -1, -1, 0,0, + 0, true, 0, 0, entityID ); } @@ -119,7 +121,8 @@ public class ScriptEntity implements IEntity { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - true, -1, -1, 0,0,0, + true, -1, -1, 0,0, + 0, true, 0, 0, entityID ); } @@ -136,7 +139,8 @@ public class ScriptEntity implements IEntity { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - true, -1, -1, 0,0,0, + true, -1, -1, 0,0, + 0, true, 0, 0, entityID ); } @@ -152,7 +156,8 @@ public class ScriptEntity implements IEntity { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - true, -1, -1, 0,0,0, + true, -1, -1, 0,0, + 0, true, 0, 0, entityID ); } @@ -167,7 +172,8 @@ public class ScriptEntity implements IEntity { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - true, -1, -1, 0,0,0, + true, -1, -1, 0,0, + 0, true, 0, 0, entityID ); }