use of am2.particles.ParticleFloatUpward in project ArsMagica2 by Mithion.
the class EntityAirGuardian method onUpdate.
@SuppressWarnings("incomplete-switch")
@Override
public void onUpdate() {
if (firstTick) {
this.tasks.addTask(0, new EntityAIGuardSpawnLocation(this, 0.5F, 5, 16, new AMVector3(this)));
this.firstTick = false;
}
this.orbitRotation += 2f;
this.orbitRotation %= 360;
switch(currentAction) {
case IDLE:
break;
case SPINNING:
this.spinRotation = (this.spinRotation - 40) % 360;
if (this.worldObj.isRemote) {
for (int i = 0; i < AMCore.config.getGFXLevel(); ++i) {
AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "wind", posX + worldObj.rand.nextDouble() * 4 - 2, posY, posZ + worldObj.rand.nextDouble() * 4 - 2);
if (particle != null) {
if (ticksInCurrentAction < BossActions.SPINNING.getMaxActionTime() - 10) {
particle.AddParticleController(new ParticleApproachEntity(particle, this, 0.2f, 0.5f, 1, true));
particle.AddParticleController(new ParticleFloatUpward(particle, 0.01f, 0.2f, 2, true));
} else {
particle.AddParticleController(new ParticleFloatUpward(particle, 0.1f, 1, 1, false));
}
particle.setMaxAge(30);
}
}
}
break;
}
if (this.motionY < 0) {
this.motionY *= 0.8999999f;
}
if (this.posY < 150) {
if (worldObj.isRemote) {
for (int i = 0; i < 25; ++i) {
AMParticle wind = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "wind", posX, posY, posZ);
if (wind != null) {
wind.setIgnoreMaxAge(false);
wind.setMaxAge(10 + rand.nextInt(10));
wind.setDontRequireControllers();
wind.addRandomOffset(1, 1, 1);
// wind.AddParticleController(new PaticleFleePoint(wind, new AMVector3(this), rand.nextInt() * 0.1f + 0.01f, 10, 1, false));
}
}
} else {
if (this.posY < 145)
this.setDead();
}
}
super.onUpdate();
}
use of am2.particles.ParticleFloatUpward in project ArsMagica2 by Mithion.
the class TileEntitySeerStone method updateEntity.
@Override
public void updateEntity() {
super.updateEntity();
if (!worldObj.isRemote && isActive()) {
if (hasSight)
PowerNodeRegistry.For(worldObj).consumePower(this, PowerTypes.LIGHT, 0.25f);
else
PowerNodeRegistry.For(worldObj).consumePower(this, PowerTypes.LIGHT, 0.125f);
}
ticksToNextCheck--;
if (ticksToNextCheck <= 0 && isActive()) {
ticksToNextCheck = maxTicksToCheck;
long key = KeystoneUtilities.instance.getKeyFromRunes(getRunesInKey());
int radius = GetSearchRadius();
Class searchClass = GetSearchClass();
ArrayList<Entity> nearbyMobs = new ArrayList<Entity>();
if (searchClass != null) {
nearbyMobs = (ArrayList<Entity>) this.worldObj.getEntitiesWithinAABB(searchClass, AxisAlignedBB.getBoundingBox(xCoord - radius, yCoord - radius, zCoord - radius, xCoord + radius, yCoord + radius, zCoord + radius));
if (key > 0) {
ArrayList<Entity> mobsToIgnore = new ArrayList<Entity>();
for (Entity e : nearbyMobs) {
if (swapDetectionMode) {
if (!(e instanceof EntityPlayer)) {
mobsToIgnore.add(e);
continue;
}
if (!KeystoneUtilities.instance.GetKeysInInvenory((EntityLivingBase) e).contains(key)) {
mobsToIgnore.add(e);
}
} else {
if (!(e instanceof EntityPlayer))
continue;
if (KeystoneUtilities.instance.GetKeysInInvenory((EntityLivingBase) e).contains(key)) {
mobsToIgnore.add(e);
}
}
}
for (Entity e : mobsToIgnore) nearbyMobs.remove(e);
}
}
if (nearbyMobs.size() > 0) {
if (!hasSight) {
hasSight = true;
notifyNeighborsOfPowerChange();
if (worldObj.isRemote) {
currentAnimation.reset(false);
currentAnimation = animations.get(0);
currentAnimation.reset(true);
}
}
} else {
if (hasSight) {
hasSight = false;
notifyNeighborsOfPowerChange();
if (worldObj.isRemote) {
currentAnimation.reset(false);
currentAnimation = animations.get(0);
currentAnimation.reset(false);
}
}
}
} else {
if (hasSight && !isActive()) {
hasSight = false;
notifyNeighborsOfPowerChange();
if (worldObj.isRemote) {
currentAnimation.reset(false);
currentAnimation = animations.get(0);
currentAnimation.reset(false);
}
}
}
// animations
if (worldObj.isRemote) {
if (!currentAnimation.isDone) {
tickCounter++;
if (tickCounter == currentAnimation.speed) {
tickCounter = 0;
currentAnimation.incrementIndex();
}
} else {
if (isActive() && hasSight) {
currentAnimation = GetWeightedRandomAnimation();
}
}
if (isActive() && hasSight) {
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
double yaw = 0;
double y = yCoord + 0.5;
double x = xCoord + 0.5;
double z = zCoord + 0.5;
switch(meta) {
case 1:
y += 0.3;
break;
case 2:
y -= 0.3;
break;
case 3:
yaw = 270;
z += 0.3;
break;
case 4:
yaw = 90;
z -= 0.3;
break;
case 5:
yaw = 180;
x += 0.3;
break;
case 6:
yaw = 0;
x -= 0.3;
break;
}
AMParticle effect = (AMParticle) AMCore.instance.proxy.particleManager.spawn(worldObj, "sparkle2", x, y, z);
if (effect != null) {
effect.setIgnoreMaxAge(false);
effect.setMaxAge(35);
switch(meta) {
case 1:
effect.AddParticleController(new ParticleFloatUpward(effect, 0.1f, -0.01f, 1, false));
break;
case 2:
effect.AddParticleController(new ParticleFloatUpward(effect, 0.1f, 0.01f, 1, false));
break;
case 3:
case 4:
case 5:
case 6:
effect.AddParticleController(new ParticleMoveOnHeading(effect, yaw, 0, 0.01f, 1, false));
effect.AddParticleController(new ParticleFloatUpward(effect, 0.1f, 0, 1, false));
}
}
}
}
}
use of am2.particles.ParticleFloatUpward 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.ParticleFloatUpward 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.ParticleFloatUpward in project ArsMagica2 by Mithion.
the class Slow 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, "sparkle", x, y + 1, z);
if (particle != null) {
particle.addRandomOffset(1, 2, 1);
particle.AddParticleController(new ParticleFloatUpward(particle, 0, -0.1f, 1, false));
particle.AddParticleController(new ParticleOrbitEntity(particle, target, 0.2f, 2, false).setIgnoreYCoordinate(true).SetTargetDistance(0.3f + rand.nextDouble() * 0.3));
particle.setMaxAge(20);
particle.setParticleScale(0.2f);
if (colorModifier > -1) {
particle.setRGBColorF(((colorModifier >> 16) & 0xFF) / 255.0f, ((colorModifier >> 8) & 0xFF) / 255.0f, (colorModifier & 0xFF) / 255.0f);
}
}
}
}
Aggregations