Search in sources :

Example 91 with AMVector3

use of am2.api.math.AMVector3 in project ArsMagica2 by Mithion.

the class ParticleArcToPoint method doUpdate.

@Override
public void doUpdate() {
    percent += speed;
    if (percent >= 1.0f) {
        this.finish();
        return;
    }
    AMVector3 bez = MathUtilities.bezier(start, firstControl, secondControl, target, percent);
    particle.setPosition(bez.x, bez.y, bez.z);
}
Also used : AMVector3(am2.api.math.AMVector3)

Example 92 with AMVector3

use of am2.api.math.AMVector3 in project ArsMagica2 by Mithion.

the class ParticleManagerClient method BoltFromEntityToEntity.

@Override
public void BoltFromEntityToEntity(World world, Entity caster, Entity source, Entity target, int damage, int type, int color) {
    double xx = target.posX;
    double yy = target.posY + target.getEyeHeight();
    double zz = target.posZ;
    double px = source.posX;
    double py = source.posY + source.getEyeHeight();
    double pz = source.posZ;
    px -= MathHelper.cos(source.rotationYaw / 180.0F * 3.141593F) * 0.16F;
    py -= 0.1000000014901161D;
    pz -= MathHelper.sin(source.rotationYaw / 180.0F * 3.141593F) * 0.16F;
    AMVector3 vec3d = MathUtilities.getLook(source, 1.0F);
    px += vec3d.x * 0.25D;
    py += vec3d.y * 0.25D;
    pz += vec3d.z * 0.25D;
    LightningBolt bolt = new LightningBolt(world, px, py, pz, xx, target.boundingBox.minY + target.height / 2.0F, zz, world.rand.nextLong(), 6, 0.3F, 6);
    bolt.defaultFractal();
    bolt.setSourceEntity(caster);
    bolt.setType(type);
    bolt.setDamage(0);
    bolt.setOverrideColor(color);
    bolt.finalizeBolt();
}
Also used : AMVector3(am2.api.math.AMVector3) LightningBolt(am2.codechicken.LightningBolt)

Example 93 with AMVector3

use of am2.api.math.AMVector3 in project ArsMagica2 by Mithion.

the class AMLineArc method onUpdate.

@Override
public void onUpdate() {
    this.ticksExisted++;
    prevPosX = posX;
    prevPosY = posY;
    prevPosZ = posZ;
    if (this.ticksExisted >= this.particleMaxAge) {
        this.setDead();
        return;
    }
    if (targetEntity != null) {
        if (ignoreAge)
            this.ticksExisted = 0;
        if (targetEntity.isDead) {
            this.setDead();
            return;
        }
        targetPoint = new AMVector3(targetEntity.posX, targetEntity.posY + targetEntity.getEyeHeight() - (targetEntity.height * 0.2f), targetEntity.posZ);
        currentTargetPoint = targetPoint.copy();
    } else if (hadTarget) {
        this.setDead();
        return;
    }
    if (sourceEntity != null) {
        if (ignoreAge)
            this.ticksExisted = 0;
        if (sourceEntity.isDead) {
            this.setDead();
            return;
        }
        sourcePoint = new AMVector3(sourceEntity.posX, sourceEntity.posY + sourceEntity.getEyeHeight() - (sourceEntity.height * 0.2f), sourceEntity.posZ);
    } else if (hadSource) {
        this.setDead();
        return;
    }
    if (extendToTarget && extensionProgress < 1.0f) {
        extensionProgress += 0.08;
        AMVector3 delta = targetPoint.copy().sub(sourcePoint);
        delta.scale(extensionProgress);
        currentTargetPoint = delta.add(sourcePoint);
    }
}
Also used : AMVector3(am2.api.math.AMVector3)

Example 94 with AMVector3

use of am2.api.math.AMVector3 in project ArsMagica2 by Mithion.

the class ParticleArcToEntity method generateControlPoints.

public ParticleArcToEntity generateControlPoints() {
    firstControl = new AMVector3(start.x + ((target.posX - start.x) / 3), start.y + ((target.posY - start.y) / 3), start.z + ((target.posZ - start.z) / 3));
    secondControl = new AMVector3(start.x + ((target.posX - start.x) / 3 * 2), start.y + ((target.posY - start.y) / 3 * 2), start.z + ((target.posZ - start.z) / 3 * 2));
    double offsetX = (particle.worldObj.rand.nextFloat() * offsetFactor) - halfOffsetFactor;
    double offsetZ = (particle.worldObj.rand.nextFloat() * offsetFactor) - halfOffsetFactor;
    AMVector3 offset = new AMVector3(offsetX, 0, offsetZ);
    firstControl = firstControl.add(offset);
    secondControl = secondControl.add(offset);
    return this;
}
Also used : AMVector3(am2.api.math.AMVector3)

Example 95 with AMVector3

use of am2.api.math.AMVector3 in project ArsMagica2 by Mithion.

the class ParticleArcToPoint method generateControlPoints.

public ParticleArcToPoint generateControlPoints() {
    firstControl = new AMVector3(start.x + ((target.x - start.x) / 3), start.y + ((target.y - start.y) / 3), start.z + ((target.z - start.z) / 3));
    secondControl = new AMVector3(start.x + ((target.x - start.x) / 3 * 2), start.y + ((target.y - start.y) / 3 * 2), start.z + ((target.z - start.z) / 3 * 2));
    double offsetX = (particle.worldObj.rand.nextFloat() * offsetFactor) - halfOffsetFactor;
    double offsetZ = (particle.worldObj.rand.nextFloat() * offsetFactor) - halfOffsetFactor;
    double offsetY = (particle.worldObj.rand.nextFloat() * offsetFactor) - halfOffsetFactor;
    AMVector3 offset = new AMVector3(offsetX, offsetY, offsetZ);
    firstControl = firstControl.add(offset);
    secondControl = secondControl.add(offset);
    return this;
}
Also used : AMVector3(am2.api.math.AMVector3)

Aggregations

AMVector3 (am2.api.math.AMVector3)113 TileEntity (net.minecraft.tileentity.TileEntity)21 EntityPlayer (net.minecraft.entity.player.EntityPlayer)16 EntityLivingBase (net.minecraft.entity.EntityLivingBase)15 ArrayList (java.util.ArrayList)11 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)11 IPowerNode (am2.api.power.IPowerNode)10 Block (net.minecraft.block.Block)9 Entity (net.minecraft.entity.Entity)9 ItemStack (net.minecraft.item.ItemStack)9 NBTTagList (net.minecraft.nbt.NBTTagList)9 IInventory (net.minecraft.inventory.IInventory)8 PowerTypes (am2.api.power.PowerTypes)6 AMParticle (am2.particles.AMParticle)5 MovingObjectPosition (net.minecraft.util.MovingObjectPosition)5 TileEntityCrystalMarker (am2.blocks.tileentities.TileEntityCrystalMarker)4 EntityDragonPart (net.minecraft.entity.boss.EntityDragonPart)4 TileEntityFlickerHabitat (am2.blocks.tileentities.TileEntityFlickerHabitat)3 AMDataWriter (am2.network.AMDataWriter)3 ParticleFloatUpward (am2.particles.ParticleFloatUpward)3