From 70c1354a4a96698758a88c032866288f79de6f5a Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Sat, 24 Aug 2024 08:16:37 -0400 Subject: Initial commit --- .../jp/plusplus/fbs/particle/EntityVortexFX.java | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 src/main/java/jp/plusplus/fbs/particle/EntityVortexFX.java (limited to 'src/main/java/jp/plusplus/fbs/particle/EntityVortexFX.java') diff --git a/src/main/java/jp/plusplus/fbs/particle/EntityVortexFX.java b/src/main/java/jp/plusplus/fbs/particle/EntityVortexFX.java new file mode 100644 index 0000000..95e85ae --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/particle/EntityVortexFX.java @@ -0,0 +1,75 @@ +package jp.plusplus.fbs.particle; + +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +/** + * Created by plusplus_F on 2015/10/18. + */ +public class EntityVortexFX extends EntityFX{ + public static final double spd=0.4; + + protected int delay; + protected float spinPitch; + protected float spinYaw; + protected float radius; + protected double firstX, firstY, firstZ; + + public EntityVortexFX(World w, double x, double y, double z, int d, double r, float red, float green, float blue, float scale) { + super(w, x, y, z); + firstX=x; + firstY=y; + firstZ=z; + rotationPitch=2*(float)Math.PI*rand.nextFloat(); + rotationYaw=2*(float)Math.PI*rand.nextFloat(); + + float a=2*(float)Math.PI*rand.nextFloat(); + spinPitch=2*(float)Math.PI/9.f* MathHelper.cos(a); + spinYaw=2*(float)Math.PI/9.f* MathHelper.sin(a); + + delay=d; + radius=0; + particleRed=red; + particleGreen=green; + particleBlue=blue; + particleAlpha=0.f; + particleScale=scale; + particleMaxAge=MathHelper.floor_double(r/spd)+delay; + this.noClip = false; + + this.setParticleTextureIndex(65); + this.onUpdate(); + } + + @Override + public void onUpdate() { + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + if (this.particleAge++ >= this.particleMaxAge) { + this.setDead(); + } + + if(particleAge>=delay){ + //座標の決定 + posX=firstX-radius*MathHelper.cos(-rotationPitch)*MathHelper.sin(-rotationYaw); + posY=firstY+radius*MathHelper.sin(-rotationPitch); + posZ=firstZ-radius*MathHelper.cos(-rotationPitch)*MathHelper.cos(-rotationYaw); + + rotationPitch+=spinPitch; + rotationYaw+=spinYaw; + radius+=spd; + + particleAlpha=1.f; + } + } + + @Override + public void renderParticle(Tessellator p_70539_1_, float p_70539_2_, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_) { + if(particleAge