use of am2.particles.AMParticle in project ArsMagica2 by Mithion.
the class TileEntityCalefactor method updateEntity.
@Override
public void updateEntity() {
super.updateEntity();
if (isFirstTick) {
rotationStepX = worldObj.rand.nextFloat() * 0.03f - 0.015f;
isFirstTick = false;
}
if (this.worldObj.isRemote) {
incrementRotations();
if (this.isCooking) {
particleCount--;
if (particleCount <= 0) {
particleCount = (int) (Math.random() * 20);
double rStartX = Math.random() > 0.5 ? this.xCoord + 0.01 : this.xCoord + 1.01;
double rStartY = this.yCoord + 1.1;
double rStartZ = Math.random() > 0.5 ? this.zCoord + 0.01 : this.zCoord + 1.01;
double endX = this.xCoord + 0.5f;
double endY = this.yCoord + 0.7f + (worldObj.rand.nextDouble() * 0.5f);
double endZ = this.zCoord + 0.5f;
AMCore.proxy.particleManager.BeamFromPointToPoint(worldObj, rStartX, rStartY, rStartZ, endX, endY, endZ, 0xFF8811);
if (worldObj.rand.nextBoolean()) {
AMParticle effect = (AMParticle) AMCore.instance.proxy.particleManager.spawn(worldObj, "smoke", endX, endY, endZ);
if (effect != null) {
effect.setIgnoreMaxAge(false);
effect.setMaxAge(60);
effect.AddParticleController(new ParticleFloatUpward(effect, 0.02f, 0.01f, 1, false));
}
} else {
AMParticle effect = (AMParticle) AMCore.instance.proxy.particleManager.spawn(worldObj, "explosion_2", endX, endY, endZ);
if (effect != null) {
effect.setIgnoreMaxAge(false);
effect.setMaxAge(10);
effect.setParticleScale(0.04f);
effect.setVelocity(worldObj.rand.nextDouble() * 0.2f - 0.1f, 0.2f, worldObj.rand.nextDouble() * 0.2f - 0.1f);
effect.setAffectedByGravity();
effect.setDontRequireControllers();
}
}
}
} else {
particleCount = 0;
}
}
boolean powerCheck = PowerNodeRegistry.For(this.worldObj).checkPower(this, getCookTickPowerCost());
if (this.canSmelt() && this.isSmelting() && powerCheck) {
++this.timeSpentCooking;
if (this.timeSpentCooking >= getModifiedCookTime()) {
if (!this.worldObj.isRemote) {
this.smeltItem();
} else {
worldObj.playSound(xCoord, yCoord, zCoord, "arsmagica2:misc.calefactor.burn", 0.2f, 1.0f, true);
}
this.timeSpentCooking = 0;
if (!worldObj.isRemote) {
sendCookStatusUpdate(false);
}
}
if (!worldObj.isRemote) {
if (PowerNodeRegistry.For(worldObj).checkPower(this, PowerTypes.DARK, getCookTickPowerCost()) && PowerNodeRegistry.For(worldObj).checkPower(this, PowerTypes.NEUTRAL, getCookTickPowerCost()) && PowerNodeRegistry.For(worldObj).checkPower(this, PowerTypes.LIGHT, getCookTickPowerCost())) {
PowerNodeRegistry.For(this.worldObj).consumePower(this, PowerTypes.DARK, getCookTickPowerCost());
PowerNodeRegistry.For(this.worldObj).consumePower(this, PowerTypes.NEUTRAL, getCookTickPowerCost());
PowerNodeRegistry.For(this.worldObj).consumePower(this, PowerTypes.LIGHT, getCookTickPowerCost());
} else {
PowerNodeRegistry.For(this.worldObj).consumePower(this, PowerNodeRegistry.For(this.worldObj).getHighestPowerType(this), getCookTickPowerCost());
}
}
} else if (!this.isSmelting() && this.canSmelt() && powerCheck) {
this.timeSpentCooking = 1;
if (!worldObj.isRemote) {
sendCookStatusUpdate(true);
}
} else if (!this.canSmelt()) {
this.timeSpentCooking = 0;
}
}
use of am2.particles.AMParticle in project ArsMagica2 by Mithion.
the class BlockInlay method randomDisplayTick.
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
int meta = world.getBlockMetadata(x, y, z);
if (world.isRemote && world.getBlock(x, y - 1, z).isAir(world, x, y, z) && AMCore.config.FullGFX() && rand.nextInt(10) < 4) {
AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(world, AMCore.config.FullGFX() ? "radiant" : "sparkle2", x + rand.nextFloat(), y, z + rand.nextFloat());
if (particle != null) {
particle.setMaxAge(20);
particle.setParticleScale(AMCore.config.FullGFX() ? 0.015f : 0.15f);
particle.AddParticleController(new ParticleFloatUpward(particle, 0.01f, -0.025f, 1, false));
if (this == BlocksCommonProxy.redstoneInlay)
particle.setRGBColorF(1.0f, 0.4f, 0.4f);
else if (this == BlocksCommonProxy.ironInlay)
particle.setRGBColorF(1.0f, 1.0f, 1.0f);
else if (this == BlocksCommonProxy.goldInlay)
particle.setRGBColorF(1.0f, 1.0f, 0.2f);
}
}
}
use of am2.particles.AMParticle in project ArsMagica2 by Mithion.
the class BlockInvisibleUtility method spawnBlockParticles.
private void spawnBlockParticles(World world, int x, int y, int z) {
AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(world, "symbols", x + 0.5, y + 0.5, z + 0.5);
if (particle != null) {
particle.addRandomOffset(1, 1.6, 1);
particle.setParticleScale(0.1f);
particle.AddParticleController(new ParticleFloatUpward(particle, 0, 0.02f, 1, false));
particle.AddParticleController(new ParticleFadeOut(particle, 1, false).setFadeSpeed(0.05f));
particle.setMaxAge(20);
if (world.rand.nextBoolean()) {
particle.setRGBColorI(0x481bc8);
} else {
particle.setRGBColorI(0x891bc8);
}
}
}
use of am2.particles.AMParticle in project ArsMagica2 by Mithion.
the class TileEntityAstralBarrier method updateEntity.
@Override
public void updateEntity() {
super.updateEntity();
int radius = getRadius();
if (IsActive()) {
PowerNodeRegistry.For(this.worldObj).consumePower(this, PowerNodeRegistry.For(worldObj).getHighestPowerType(this), 0.35f * radius);
}
if (worldObj.isRemote) {
if (IsActive()) {
if (displayAura) {
AMParticle effect = (AMParticle) AMCore.instance.proxy.particleManager.spawn(worldObj, "symbols", xCoord, yCoord + 0.5, zCoord);
if (effect != null) {
effect.setIgnoreMaxAge(false);
effect.setMaxAge(100);
effect.setParticleScale(0.5f);
effect.AddParticleController(new ParticleOrbitPoint(effect, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 1, false).SetOrbitSpeed(0.03).SetTargetDistance(radius));
}
}
particleTickCounter++;
if (particleTickCounter >= 15) {
particleTickCounter = 0;
String particleName = "";
AMParticle effect = (AMParticle) AMCore.instance.proxy.particleManager.spawn(worldObj, "sparkle", xCoord + 0.5, yCoord + 0.1 + worldObj.rand.nextDouble() * 0.5, zCoord + 0.5);
if (effect != null) {
effect.setIgnoreMaxAge(false);
effect.setMaxAge(100);
effect.setParticleScale(0.5f);
float color = worldObj.rand.nextFloat() * 0.2f + 0.8f;
effect.AddParticleController(new ParticleOrbitPoint(effect, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, 1, false).SetOrbitSpeed(0.005).SetTargetDistance(worldObj.rand.nextDouble() * 0.6 - 0.3));
effect.AddParticleController(new ParticleHoldPosition(effect, 80, 2, true));
effect.AddParticleController(new ParticleFadeOut(effect, 3, false).setFadeSpeed(0.05f));
}
}
}
}
}
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));
}
}
}
Aggregations