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);
}
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();
}
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);
}
}
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;
}
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;
}
Aggregations