use of am2.particles.AMParticle in project ArsMagica2 by Mithion.
the class Invisiblity 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, "ember", x, y - 1, z);
if (particle != null) {
particle.addRandomOffset(1, 1, 1);
particle.AddParticleController(new ParticleFloatUpward(particle, 0, 0.1f, 1, false));
particle.AddParticleController(new ParticleOrbitPoint(particle, x, y, z, 2, false).SetOrbitSpeed(0.5f).setIgnoreYCoordinate(true).SetTargetDistance(0.3f + rand.nextDouble() * 0.3));
particle.AddParticleController(new ParticleFadeOut(particle, 3, false).setFadeSpeed(0.05f).setKillParticleOnFinish(true));
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 HarvestPlants 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 + 1, z);
if (particle != null) {
particle.addRandomOffset(1, 1, 1);
particle.AddParticleController(new ParticleFloatUpward(particle, 0, 0.3f, 1, false));
particle.setAffectedByGravity();
particle.setMaxAge(20);
particle.setParticleScale(0.1f);
particle.setRGBColorF(0.7f, 0.2f, 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 BlockWitchwoodLeaves method randomDisplayTick.
@Override
public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
if (!AMCore.config.witchwoodLeafPFX())
return;
if (par5Random.nextInt(300) == 0 && par1World.isAirBlock(par2, par3 - 1, par4)) {
AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(par1World, "leaf", par2 + par5Random.nextDouble(), par3 + par5Random.nextDouble(), par4 + par5Random.nextDouble());
if (particle != null) {
particle.AddParticleController(new ParticleFloatUpward(particle, 0, -0.05f, 1, false));
particle.setMaxAge(120);
particle.noClip = false;
particle.setParticleScale(0.1f + par5Random.nextFloat() * 0.1f);
particle.AddParticleController(new ParticlePendulum(particle, 0.2f, 0.15f + par5Random.nextFloat() * 0.2f, 2, false));
}
}
}
use of am2.particles.AMParticle in project ArsMagica2 by Mithion.
the class VinteumTorch method spawnParticle.
@SideOnly(Side.CLIENT)
private void spawnParticle(World world, double x, double y, double z) {
AMParticle effect = (AMParticle) AMCore.instance.proxy.particleManager.spawn(world, "light", x, y, z);
if (effect != null) {
effect.setMaxAge(3);
effect.setIgnoreMaxAge(false);
effect.setRGBColorF(0.69f, 0.89f, 1.0f);
effect.AddParticleController(new ParticleFloatUpward(effect, 0, 0.01f, 1, false));
}
}
use of am2.particles.AMParticle 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;
}
Aggregations