use of am2.particles.ParticleFadeOut in project ArsMagica2 by Mithion.
the class AMPacketProcessorClient method handleStarFall.
private void handleStarFall(byte[] data) {
AMDataReader rdr = new AMDataReader(data, false);
double x = rdr.getDouble();
double y = rdr.getDouble();
double z = rdr.getDouble();
ItemStack spellStack = null;
if (rdr.getBoolean())
spellStack = rdr.getItemStack();
int color = -1;
if (spellStack != null) {
if (SpellUtils.instance.modifierIsPresent(SpellModifiers.COLOR, spellStack, 0)) {
ISpellModifier[] mods = SpellUtils.instance.getModifiersForStage(spellStack, 0);
int ordinalCount = 0;
for (ISpellModifier mod : mods) {
if (mod instanceof Colour) {
byte[] meta = SpellUtils.instance.getModifierMetadataFromStack(spellStack, mod, 0, ordinalCount++);
color = (int) mod.getModifier(SpellModifiers.COLOR, null, null, null, meta);
}
}
}
}
for (int i = 0; i < 360; i += AMCore.config.FullGFX() ? 5 : AMCore.config.LowGFX() ? 10 : 20) {
AMParticle effect = (AMParticle) AMCore.instance.proxy.particleManager.spawn(Minecraft.getMinecraft().theWorld, "sparkle2", x, y + 1.5, z);
if (effect != null) {
effect.setIgnoreMaxAge(true);
effect.AddParticleController(new ParticleMoveOnHeading(effect, i, 0, 0.7f, 1, false));
float clrMod = Minecraft.getMinecraft().theWorld.rand.nextFloat();
int finalColor = -1;
if (color == -1)
finalColor = MathUtilities.colorFloatsToInt(0.24f * clrMod, 0.58f * clrMod, 0.71f * clrMod);
else {
float[] colors = MathUtilities.colorIntToFloats(color);
for (int c = 0; c < colors.length; ++c) colors[c] = colors[c] * clrMod;
finalColor = MathUtilities.colorFloatsToInt(colors[0], colors[1], colors[2]);
}
effect.setParticleScale(1.2f);
effect.noClip = false;
effect.setRGBColorI(finalColor);
effect.AddParticleController(new ParticleFadeOut(effect, 1, false).setFadeSpeed(0.05f).setKillParticleOnFinish(true));
effect.AddParticleController(new ParticleLeaveParticleTrail(effect, "sparkle2", false, 15, 1, false).addControllerToParticleList(new ParticleChangeSize(effect, 1.2f, 0.01f, 15, 1, false)).setParticleRGB_I(finalColor).setChildAffectedByGravity().addRandomOffset(0.2f, 0.2f, 0.2f));
}
}
Minecraft.getMinecraft().theWorld.playSound(x, y, z, "arsmagica2:spell.special.starfall", 2.0f, 1.0f, false);
}
use of am2.particles.ParticleFadeOut in project ArsMagica2 by Mithion.
the class EntityFlicker method flick.
private void flick() {
if (this.worldObj.isRemote) {
for (int i = 0; i < 10 * AMCore.config.getGFXLevel(); ++i) {
AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "radiant", posX, posY, posZ);
if (particle != null) {
particle.AddParticleController(new ParticleMoveOnHeading(particle, worldObj.rand.nextDouble() * 360, worldObj.rand.nextDouble() * 360, worldObj.rand.nextDouble() * 0.3f + 0.01f, 1, false));
particle.setRGBColorI(getFlickerAffinity().color);
particle.AddParticleController(new ParticleFadeOut(particle, 1, false).setFadeSpeed((float) (worldObj.rand.nextDouble() * 0.1 + 0.05)).setKillParticleOnFinish(true));
particle.setIgnoreMaxAge(true);
particle.setParticleScale(0.1f);
}
}
} else {
this.setDead();
}
}
use of am2.particles.ParticleFadeOut in project ArsMagica2 by Mithion.
the class EntityManaVortex method onUpdate.
@Override
public void onUpdate() {
this.ticksExisted++;
this.rotation += 5;
if (!this.worldObj.isRemote && (this.isDead || this.ticksExisted >= getTicksToExist())) {
this.setDead();
return;
}
if (this.getTicksToExist() - this.ticksExisted <= 20) {
this.scale -= 1f / 20f;
} else if (this.scale < 0.99f) {
this.scale = (float) (Math.sin((float) this.ticksExisted / 50));
}
if (getTicksToExist() - this.ticksExisted <= 5 && !hasGoneBoom) {
hasGoneBoom = true;
if (!worldObj.isRemote) {
List players = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.boundingBox.expand(3 + Math.floor(this.ticksExisted / 50), 2, 3 + Math.floor(this.ticksExisted / 50)));
float damage = this.dataWatcher.getWatchableObjectFloat(DW_MANA_STOLEN) * 0.005f;
if (damage > 100)
damage = 100;
Object[] playerArray = players.toArray();
for (Object o : playerArray) {
EntityLivingBase e = (EntityLivingBase) o;
MovingObjectPosition mop = this.worldObj.rayTraceBlocks(Vec3.createVectorHelper(this.posX, this.posY, this.posZ), Vec3.createVectorHelper(e.posX, e.posY + e.getEyeHeight(), e.posZ), false);
if (mop == null)
e.attackEntityFrom(DamageSources.causeEntityPhysicalDamage(this), damage);
}
} else {
for (int i = 0; i < 360; i += AMCore.config.FullGFX() ? 5 : AMCore.config.LowGFX() ? 10 : 20) {
AMParticle effect = (AMParticle) AMCore.instance.proxy.particleManager.spawn(worldObj, "ember", this.posX, this.posY, this.posZ);
if (effect != null) {
effect.setIgnoreMaxAge(true);
effect.AddParticleController(new ParticleMoveOnHeading(effect, i, 0, 0.7f, 1, false));
effect.setRGBColorF(0.24f, 0.24f, 0.8f);
effect.noClip = false;
effect.AddParticleController(new ParticleFadeOut(effect, 1, false).setFadeSpeed(0.05f).setKillParticleOnFinish(true));
effect.AddParticleController(new ParticleLeaveParticleTrail(effect, "ember", false, 5, 1, false).addControllerToParticleList(new ParticleMoveOnHeading(effect, i, 0, 0.1f, 1, false)).addControllerToParticleList(new ParticleFadeOut(effect, 1, false).setFadeSpeed(0.1f).setKillParticleOnFinish(true)).setParticleRGB_F(0.24f, 0.24f, 0.8f).addRandomOffset(0.2f, 0.2f, 0.2f));
}
}
}
}
if (getTicksToExist() - this.ticksExisted > 30) {
// get all players within 5 blocks
List<EntityLivingBase> players = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.boundingBox.expand(3 + Math.floor(this.ticksExisted / 50), 2, 3 + Math.floor(this.ticksExisted / 50)));
Object[] playerArray = players.toArray();
Vec3 thisPos = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
for (Object o : playerArray) {
EntityLivingBase e = (EntityLivingBase) o;
MovingObjectPosition mop = this.worldObj.rayTraceBlocks(Vec3.createVectorHelper(this.posX, this.posY, this.posZ), Vec3.createVectorHelper(e.posX, e.posY + e.getEyeHeight(), e.posZ), false);
if (mop != null)
continue;
Vec3 playerPos = Vec3.createVectorHelper(e.posX, e.posY + e.getEyeHeight(), e.posZ);
if (worldObj.isRemote) {
if (AMCore.config.NoGFX()) {
break;
}
if (AMCore.config.LowGFX() && (this.ticksExisted % 4) != 0) {
break;
}
AMParticle effect = (AMParticle) AMCore.instance.proxy.particleManager.spawn(worldObj, "ember", e.posX, e.posY + (e.getEyeHeight() / 2), e.posZ);
if (effect != null) {
effect.AddParticleController(new ParticleArcToEntity(effect, 1, this, false).generateControlPoints().setKillParticleOnFinish(true));
effect.setRGBColorF(0.24f, 0.24f, 0.8f);
effect.setIgnoreMaxAge(true);
}
}
float manaStolen = ExtendedProperties.For(e).getMaxMana() * 0.01f;
float curMana = ExtendedProperties.For(e).getCurrentMana();
if (manaStolen > curMana)
manaStolen = curMana;
this.dataWatcher.updateObject(DW_MANA_STOLEN, this.dataWatcher.getWatchableObjectFloat(DW_MANA_STOLEN) + manaStolen);
ExtendedProperties.For(e).setCurrentMana(ExtendedProperties.For(e).getCurrentMana() - manaStolen);
AMVector3 movement = MathUtilities.GetMovementVectorBetweenEntities(e, this);
float speed = -0.075f;
e.addVelocity(movement.x * speed, movement.y * speed, movement.z * speed);
}
}
}
use of am2.particles.ParticleFadeOut in project ArsMagica2 by Mithion.
the class EntityAirSled method onUpdate.
@Override
public void onUpdate() {
this.stepHeight = 1.02f;
if (worldObj.isRemote) {
rotation += 1f;
if (this.worldObj.isAirBlock((int) this.posX, (int) (this.posY - 1), (int) this.posZ)) {
for (int i = 0; i < AMCore.config.getGFXLevel(); ++i) {
AMParticle cloud = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "sparkle2", posX, posY + 0.5, posZ);
if (cloud != null) {
cloud.addRandomOffset(1, 1, 1);
cloud.AddParticleController(new ParticleFadeOut(cloud, 1, false).setFadeSpeed(0.01f));
}
}
}
}
super.onUpdate();
}
use of am2.particles.ParticleFadeOut in project ArsMagica2 by Mithion.
the class TileEntityCraftingAltar method updateEntity.
@Override
public void updateEntity() {
super.updateEntity();
this.ticksExisted++;
checkStructure();
checkForStartCondition();
updateLecternInformation();
if (isCrafting) {
checkForEndCondition();
updatePowerRequestData();
if (!worldObj.isRemote && !currentDefinitionIsWithinStructurePower() && this.ticksExisted > 100) {
worldObj.newExplosion(null, xCoord + 0.5, yCoord - 1.5, zCoord + 0.5, 5, false, true);
setCrafting(false);
return;
}
if (worldObj.isRemote && checkCounter == 1) {
AMCore.proxy.particleManager.RibbonFromPointToPoint(worldObj, xCoord + 0.5, yCoord - 2, zCoord + 0.5, xCoord + 0.5, yCoord - 3, zCoord + 0.5);
}
List<EntityItem> components = lookForValidItems();
ItemStack stack = getNextPlannedItem();
for (EntityItem item : components) {
if (item.isDead)
continue;
ItemStack entityItemStack = item.getEntityItem();
if (stack != null && compareItemStacks(stack, entityItemStack)) {
if (!worldObj.isRemote) {
updateCurrentRecipe(item);
item.setDead();
} else {
worldObj.playSound(xCoord, yCoord, zCoord, "arsmagica2:misc.craftingaltar.component_added", 1.0f, 0.4f + worldObj.rand.nextFloat() * 0.6f, false);
for (int i = 0; i < 5 * AMCore.config.getGFXLevel(); ++i) {
AMParticle particle = (AMParticle) AMCore.proxy.particleManager.spawn(worldObj, "radiant", item.posX, item.posY, item.posZ);
if (particle != null) {
particle.setMaxAge(40);
particle.AddParticleController(new ParticleMoveOnHeading(particle, worldObj.rand.nextFloat() * 360, worldObj.rand.nextFloat() * 360, 0.01f, 1, false));
particle.AddParticleController(new ParticleFadeOut(particle, 1, false).setFadeSpeed(0.05f).setKillParticleOnFinish(true));
particle.setParticleScale(0.02f);
particle.setRGBColorF(worldObj.rand.nextFloat(), worldObj.rand.nextFloat(), worldObj.rand.nextFloat());
}
}
}
}
}
}
}
Aggregations