mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-25 14:44:35 +00:00
All devs and contributors should use the provided formatter settings. If your IDE does not support the format, the rules are simple, it is the default java formatting rules, with 200char line lengths and 1 extra line after class definitions.
62 lines
1.5 KiB
Java
62 lines
1.5 KiB
Java
package com.cricketcraft.chisel.entity.fx;
|
|
|
|
import net.minecraft.client.particle.EntityFX;
|
|
import net.minecraft.client.renderer.Tessellator;
|
|
import net.minecraft.world.World;
|
|
|
|
import com.cricketcraft.chisel.block.BlockGrimstone;
|
|
import com.cricketcraft.chisel.utils.General;
|
|
|
|
public class EntityGrimstoneFX extends EntityFX {
|
|
|
|
float initialScale;
|
|
float angleOffset;
|
|
static final float fadetime = 20f;
|
|
|
|
public EntityGrimstoneFX(World world, BlockGrimstone block, double x, double y, double z) {
|
|
super(world, x, y, z, 0, 0, 0);
|
|
|
|
initialScale = 1.0f + 1.0f * General.rand.nextFloat();
|
|
angleOffset = rand.nextFloat() * 360;
|
|
|
|
particleMaxAge = (int) (Math.random() * 10.0D) + 80;
|
|
|
|
setPosition(x, y, z);
|
|
prevPosX = posX;
|
|
prevPosY = posY;
|
|
prevPosZ = posZ;
|
|
|
|
noClip = true;
|
|
|
|
setParticleIcon(block.iconStar);
|
|
}
|
|
|
|
@Override
|
|
public int getFXLayer() {
|
|
return 1;
|
|
}
|
|
|
|
@Override
|
|
public void renderParticle(Tessellator tessellator, float partialTick, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) {
|
|
particleScale = 0.25f + initialScale * (float) Math.sin((particleAge + angleOffset) / 180.f);
|
|
|
|
if (particleAge < fadetime)
|
|
particleAlpha = particleAge / fadetime;
|
|
else if (particleAge + fadetime >= particleMaxAge)
|
|
particleAlpha = (particleMaxAge - particleAge) / fadetime;
|
|
else
|
|
particleAlpha = 1.0f;
|
|
|
|
super.renderParticle(tessellator, partialTick, rotX, rotXZ, rotZ, rotYZ, rotXY);
|
|
|
|
}
|
|
|
|
@Override
|
|
public void onUpdate() {
|
|
if (particleAge++ >= particleMaxAge) {
|
|
setDead();
|
|
}
|
|
|
|
}
|
|
}
|