ScriptEntityParticle:

-Particles can now start or end at a certain tick, and loop or not loop.
-Added setSize(), getWidth() and getHeight() functions.
-Added setOffset(), getOffsetX(), and getOffsetY() functions.
-Added setAnimRate() and getAnimRate() functions.
This commit is contained in:
Luis C.M committed 2022-05-06 01:22:48 -05:00
1 parent 728269ff87
commit 2d2933e873
5 files changed
+55 -16

No files matched your search

@@ -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
);
}
@@ -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++){
@@ -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;
}
}
@@ -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; }
@@ -82,7 +82,8 @@ public class ScriptEntity<T extends Entity> 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<T extends Entity> 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<T extends Entity> 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<T extends Entity> 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<T extends Entity> 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<T extends Entity> 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
);
}