use of am2.particles.ParticleFadeOut in project ArsMagica2 by Mithion.
the class ItemCrystalWrench method spawnLinkParticles.
private void spawnLinkParticles(World world, double hitX, double hitY, double hitZ, boolean disconnect) {
for (int i = 0; i < 10; ++i) {
AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(world, "none_hand", hitX, hitY, hitZ);
if (particle != null) {
if (disconnect) {
particle.setRGBColorF(1, 0, 0);
particle.addRandomOffset(0.5f, 0.5f, 0.5f);
}
particle.setMaxAge(10);
particle.setParticleScale(0.1f);
particle.AddParticleController(new ParticleMoveOnHeading(particle, world.rand.nextInt(360), world.rand.nextInt(360), world.rand.nextDouble() * 0.2, 1, false));
particle.AddParticleController(new ParticleFadeOut(particle, 1, false).setFadeSpeed(0.1f));
}
}
}
use of am2.particles.ParticleFadeOut in project ArsMagica2 by Mithion.
the class FlickerOperatorLight method DoOperation.
@Override
public boolean DoOperation(World worldObj, IFlickerController habitat, boolean powered) {
if (!worldObj.isRemote) {
int radius = 16;
int yRadius = radius / 4;
int checksPerOperation = 8;
int checkX = ((TileEntity) habitat).xCoord - radius;
int checkY = ((TileEntity) habitat).yCoord - yRadius;
int checkZ = ((TileEntity) habitat).zCoord - radius;
byte[] meta = habitat.getMetadata(this);
if (meta.length != 0) {
AMDataReader rdr = new AMDataReader(meta, false);
checkX = rdr.getInt();
checkY = rdr.getInt();
checkZ = rdr.getInt();
}
for (int i = 0; i < checksPerOperation; ++i) {
int light = worldObj.getBlockLightValue(checkX, checkY, checkZ);
if (light < 10 && worldObj.isAirBlock(checkX, checkY, checkZ)) {
worldObj.setBlock(checkX, checkY, checkZ, BlocksCommonProxy.invisibleUtility, 10, 2);
}
checkX++;
if (checkX > ((TileEntity) habitat).xCoord + radius) {
checkX = ((TileEntity) habitat).xCoord - radius;
checkY++;
if (checkY > ((TileEntity) habitat).yCoord + yRadius) {
checkY = ((TileEntity) habitat).yCoord - yRadius;
checkZ++;
if (checkZ > ((TileEntity) habitat).zCoord + radius) {
checkZ = ((TileEntity) habitat).zCoord - radius;
}
}
}
}
AMDataWriter writer = new AMDataWriter();
writer.add(checkX).add(checkY).add(checkZ);
habitat.setMetadata(this, writer.generate());
} else {
AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "sparkle", ((TileEntity) habitat).xCoord + 0.5, ((TileEntity) habitat).yCoord + 1, ((TileEntity) habitat).zCoord + 0.5);
if (particle != null) {
particle.addRandomOffset(0.5, 0.4, 0.5);
particle.AddParticleController(new ParticleFloatUpward(particle, 0, 0.02f, 1, false));
particle.AddParticleController(new ParticleFadeOut(particle, 1, false).setFadeSpeed(0.05f));
particle.setMaxAge(20);
}
}
return true;
}
use of am2.particles.ParticleFadeOut in project ArsMagica2 by Mithion.
the class TileEntityCrystalMarkerSpellExport method spawnParticles.
private void spawnParticles() {
for (int i = 0; i < 15; ++i) {
AMParticle effect = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "sparkle2", xCoord, yCoord, zCoord);
if (effect != null) {
effect.AddParticleController(new ParticleFloatUpward(effect, 0, worldObj.rand.nextFloat() * 0.1f, 1, false));
effect.AddParticleController(new ParticleFadeOut(effect, 2, false).setFadeSpeed(0.035f).setKillParticleOnFinish(true));
effect.addRandomOffset(0.2, 0.2, 0.2);
effect.setRGBColorF(0, 0.5f, 1.0f);
effect.setIgnoreMaxAge(true);
}
}
}
use of am2.particles.ParticleFadeOut in project ArsMagica2 by Mithion.
the class TileEntityLectern method updateEntity.
@Override
public void updateEntity() {
if (worldObj.isRemote) {
updateBookRender();
if (tooltipStack != null && field_145926_a % 2 == 0) {
AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "sparkle", xCoord + 0.5 + ((worldObj.rand.nextDouble() * 0.2) - 0.1), yCoord + 1, zCoord + 0.5 + ((worldObj.rand.nextDouble() * 0.2) - 0.1));
if (particle != null) {
particle.AddParticleController(new ParticleMoveOnHeading(particle, worldObj.rand.nextDouble() * 360, -45 - worldObj.rand.nextInt(90), 0.05f, 1, false));
particle.AddParticleController(new ParticleFadeOut(particle, 2, false).setFadeSpeed(0.05f).setKillParticleOnFinish(true));
particle.setIgnoreMaxAge(true);
if (getOverpowered()) {
particle.setRGBColorF(1.0f, 0.2f, 0.2f);
}
}
}
}
}
use of am2.particles.ParticleFadeOut in project ArsMagica2 by Mithion.
the class Repel method spawnParticles.
@Override
public void spawnParticles(World world, double x, double y, double z, EntityLivingBase caster, Entity target, Random rand, int colorModifier) {
AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(world, "sparkle", x, y, z);
if (particle != null) {
particle.addRandomOffset(1, 2, 1);
double dx = caster.posX - target.posX;
double dz = caster.posZ - target.posZ;
double angle = Math.toDegrees(Math.atan2(-dz, -dx));
particle.AddParticleController(new ParticleMoveOnHeading(particle, angle, 0, 0.1 + rand.nextDouble() * 0.5, 1, false));
particle.AddParticleController(new ParticleFadeOut(particle, 1, false).setFadeSpeed(0.05f));
particle.setMaxAge(20);
if (colorModifier > -1) {
particle.setRGBColorF(((colorModifier >> 16) & 0xFF) / 255.0f, ((colorModifier >> 8) & 0xFF) / 255.0f, (colorModifier & 0xFF) / 255.0f);
}
}
}
Aggregations