use of am2.particles.AMParticle in project ArsMagica2 by Mithion.
the class TileEntityInscriptionTable method candleUpdate.
private void candleUpdate() {
ticksToNextParticle--;
if (isRenderingLeft()) {
if (ticksToNextParticle == 0 || ticksToNextParticle == 15) {
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord) & ~0x8;
double particleX = 0;
double particleZ = 0;
switch(meta) {
case 1:
particleX = this.xCoord + 0.15;
particleZ = this.zCoord + 0.22;
break;
case 2:
particleX = this.xCoord + 0.22;
particleZ = this.zCoord + 0.85;
break;
case 3:
particleX = this.xCoord + 0.83;
particleZ = this.zCoord + 0.78;
break;
case 4:
particleX = this.xCoord + 0.79;
particleZ = this.zCoord + 0.15;
break;
}
ticksToNextParticle = 30;
AMParticle effect = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "fire", particleX, yCoord + 1.32, particleZ);
if (effect != null) {
effect.setParticleScale(0.025f, 0.1f, 0.025f);
effect.AddParticleController(new ParticleHoldPosition(effect, 29, 1, false));
effect.setIgnoreMaxAge(false);
effect.setMaxAge(400);
}
if (worldObj.rand.nextInt(100) > 80) {
AMParticle smoke = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "smoke", particleX, yCoord + 1.4, particleZ);
if (smoke != null) {
smoke.setParticleScale(0.025f);
smoke.AddParticleController(new ParticleFloatUpward(smoke, 0.01f, 0.01f, 1, false));
smoke.setIgnoreMaxAge(false);
smoke.setMaxAge(20 + worldObj.rand.nextInt(10));
}
}
}
if (ticksToNextParticle == 10 || ticksToNextParticle == 25) {
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord) & ~0x8;
double particleX = 0;
double particleZ = 0;
switch(meta) {
case 1:
particleX = this.xCoord + 0.59;
particleZ = this.zCoord - 0.72;
break;
case 2:
particleX = this.xCoord - 0.72;
particleZ = this.zCoord + 0.41;
break;
case 3:
particleX = this.xCoord + 0.41;
particleZ = this.zCoord + 1.72;
break;
case 4:
particleX = this.xCoord + 1.72;
particleZ = this.zCoord + 0.60;
break;
}
AMParticle effect = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "fire", particleX, yCoord + 1.26, particleZ);
if (effect != null) {
effect.setParticleScale(0.025f, 0.1f, 0.025f);
effect.AddParticleController(new ParticleHoldPosition(effect, 29, 1, false));
effect.setIgnoreMaxAge(false);
effect.setMaxAge(400);
}
if (worldObj.rand.nextInt(100) > 80) {
AMParticle smoke = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "smoke", particleX, yCoord + 1.4, particleZ);
if (smoke != null) {
smoke.setParticleScale(0.025f);
smoke.AddParticleController(new ParticleFloatUpward(smoke, 0.01f, 0.01f, 1, false));
smoke.setIgnoreMaxAge(false);
smoke.setMaxAge(20 + worldObj.rand.nextInt(10));
}
}
}
}
}
use of am2.particles.AMParticle in project ArsMagica2 by Mithion.
the class TileEntitySlipstreamGenerator method spawnParticles.
private void spawnParticles(EntityPlayer player) {
AMParticle wind = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "wind", player.posX, player.posY - player.height, player.posZ);
float pitch = player.rotationPitch;
float factor = (pitch > 0 ? (pitch - 10) : (pitch + 10)) / -180.0f;
if (player.isSneaking())
factor = 0.01f;
if (wind != null) {
wind.setMaxAge(10);
wind.addRandomOffset(1, 1, 1);
wind.setParticleScale(0.1f);
wind.AddParticleController(new ParticleFloatUpward(wind, 0, Math.abs(factor) * 2, 1, false));
}
}
use of am2.particles.AMParticle in project ArsMagica2 by Mithion.
the class Disarm method spawnParticles.
@Override
public void spawnParticles(World world, double x, double y, double z, EntityLivingBase caster, Entity target, Random rand, int colorModifier) {
for (int i = 0; i < 25; ++i) {
AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(world, "sparkle2", x, y, z);
if (particle != null) {
particle.addRandomOffset(1, 2, 1);
particle.AddParticleController(new ParticleMoveOnHeading(particle, MathHelper.wrapAngleTo180_double((target instanceof EntityLivingBase ? ((EntityLivingBase) target).rotationYawHead : target.rotationYaw) + 90), MathHelper.wrapAngleTo180_double(target.rotationPitch), 0.1 + rand.nextDouble() * 0.5, 1, false));
particle.AddParticleController(new ParticleFadeOut(particle, 1, false).setFadeSpeed(0.05f));
particle.setAffectedByGravity();
if (rand.nextBoolean())
particle.setRGBColorF(0.7f, 0.7f, 0.1f);
else
particle.setRGBColorF(0.1f, 0.7f, 0.1f);
particle.setMaxAge(40);
particle.setParticleScale(0.1f);
if (colorModifier > -1) {
particle.setRGBColorF(((colorModifier >> 16) & 0xFF) / 255.0f, ((colorModifier >> 8) & 0xFF) / 255.0f, (colorModifier & 0xFF) / 255.0f);
}
}
}
}
use of am2.particles.AMParticle in project ArsMagica2 by Mithion.
the class Entangle method spawnParticles.
@Override
public void spawnParticles(World world, double x, double y, double z, EntityLivingBase caster, Entity target, Random rand, int colorModifier) {
for (int i = 0; i < 25; ++i) {
AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(world, "plant", x, y, z);
if (particle != null) {
particle.addRandomOffset(1, 2, 1);
particle.AddParticleController(new ParticleApproachEntity(particle, target, 0.15f, 0.4f, 1, false));
particle.setMaxAge(20);
particle.setParticleScale(0.1f);
if (colorModifier > -1) {
particle.setRGBColorF(((colorModifier >> 16) & 0xFF) / 255.0f, ((colorModifier >> 8) & 0xFF) / 255.0f, (colorModifier & 0xFF) / 255.0f);
}
}
}
}
use of am2.particles.AMParticle in project ArsMagica2 by Mithion.
the class FireDamage method spawnParticles.
@Override
public void spawnParticles(World world, double x, double y, double z, EntityLivingBase caster, Entity target, Random rand, int colorModifier) {
for (int i = 0; i < 5; ++i) {
AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(world, "explosion_2", x, y, z);
if (particle != null) {
particle.addRandomOffset(1, 0.5, 1);
particle.addVelocity(rand.nextDouble() * 0.2 - 0.1, rand.nextDouble() * 0.2, rand.nextDouble() * 0.2 - 0.1);
particle.setAffectedByGravity();
particle.setDontRequireControllers();
particle.setMaxAge(5);
particle.setParticleScale(0.1f);
if (colorModifier > -1) {
particle.setRGBColorF(((colorModifier >> 16) & 0xFF) / 255.0f, ((colorModifier >> 8) & 0xFF) / 255.0f, (colorModifier & 0xFF) / 255.0f);
}
}
}
}
Aggregations