You are on page 1of 3

if (!

bounced) {

/*
//Location loc1 = currentLocation.clone();
Location prevLoc = previousLocation.clone();
Location curLoc = currentLocation.clone();
//curLoc.getDirection().multiply(-1D);
spell.playEffects(EffectPosition.BUFF, curLoc);
spell.playEffects(EffectPosition.DISABLED, prevLoc);

//Vector v2 =
prevLoc.toVector().add(curLoc.toVector()).normalize();

//spell.playEffects(EffectPosition.BLOCK_DESTRUCTION,
currentLocation.clone().subtract(v2));

//spell.playEffects(EffectPosition.ORBIT,
currentLocation.clone().add(v2));

Vector v =
curLoc.toVector().subtract(prevLoc.toVector()).normalize().multiply(0.001D);

curLoc.setDirection(curLoc.getDirection().multiply(-1F));
//prevLoc.setDirection(prevLoc.getDirection().multiply(-
1F));
Location l = linetest(curLoc, prevLoc, 0.1, 0);

spell.playEffects(EffectPosition.DELAYED, l);

Vector v1 = prevLoc.getDirection();
Vector v2 = l.getDirection().normalize();

Vector output = v1.subtract(v2.multiply(v1.dot(v2) *


2.0D));

spell.playEffects(EffectPosition.BLOCK_DESTRUCTION,
prevLoc.setDirection(output));

//Vector v1 = currentLocation.clone().getDirection();

//Vector output =
v1.clone().subtract(v2.clone().multiply(v1.clone().dot(v2.clone()) * 2.0D));
//spell.playEffects(EffectPosition.ORBIT,
currentLocation.clone().setDirection(output));

//currentVelocity.subtract(output);
//Bukkit.broadcastMessage(v.toString() + " " +
v2.toString() + " " + output.toString() + " ");
*/

/*Location entityLoc = previousLocation.clone();


//Location wallLoc = b.getLocation().add(0.5,0,0.5);
Location wallLoc =
currentLocation.clone().setDirection(currentLocation.clone().getDirection().multipl
y(-1D));
Vector v = currentVelocity.clone();
Vector v2 =
entityLoc.toVector().subtract(wallLoc.toVector()).normalize();

Vector output = v.subtract(v2.multiply(v.dot(v2) * 2.0D));

spell.playEffects(EffectPosition.BLOCK_DESTRUCTION,
entityLoc.subtract(v2));
spell.playEffects(EffectPosition.ORBIT, entityLoc.add(v2));
spell.playEffects(EffectPosition.BUFF,
entityLoc.setDirection(v2)); */

/*Location eLoc = previousLocation.clone();


Location wallLoc = currentLocation.clone();

Vector to = new Vector(eLoc.getX(), eLoc.getY(),


eLoc.getZ());
Vector from = new Vector(wallLoc.getX(), wallLoc.getY(),
wallLoc.getZ());

Vector v = to.subtract(from);

spell.playEffects(EffectPosition.BLOCK_DESTRUCTION,
wallLoc.clone().setDirection(v));

Vector v1 = currentVelocity.clone();
Vector v2 = v.clone().normalize();
Vector output = v1.subtract(v2.multiply(v1.dot(v2) *
2.0D));

currentVelocity = output;

spell.playEffects(EffectPosition.ORBIT,
eLoc.clone().setDirection(output));
//spell.playEffects(EffectPosition.BUFF,
eLoc.clone().add(v)); */

Location eLoc = previousLocation.clone();


Location wallLoc = b.getLocation().add(0.5, 0.5,
0.5).clone();

Bukkit.broadcastMessage(eLoc.getYaw() + " eLoc");

//Location loc1 = b.getLocation().clone();


//Location loc2 = currentLocation.clone();

//Vector v =
loc2.toVector().subtract(loc1.toVector()).normalize();

Vector to = new Vector(eLoc.getX(), eLoc.getY(),


eLoc.getZ());
Vector from = new Vector(wallLoc.getX(), wallLoc.getY(),
wallLoc.getZ());

Vector v = to.subtract(from);

Location loc1 = wallLoc.clone().setDirection(v);


Bukkit.broadcastMessage(loc1.getYaw() + " yawt");

spell.playEffects(EffectPosition.BUFF, loc1);

BlockFace face = getCardinalDirection(loc1);


if (face != null) Bukkit.broadcastMessage(face.toString() +
" gneralized and not " + b.getFace(eLoc.getBlock()).toString());

Vector n = face.getDirection().normalize();
Vector d = eLoc.getDirection();

spell.playEffects(EffectPosition.ORBIT,
eLoc.clone().setDirection(n));

Vector r = d.subtract(n.multiply(d.dot(n) * 2.0D));

currentVelocity = r.normalize().multiply(projectileVelocity
/ ticksPerSecond);

spell.playEffects(EffectPosition.BLOCK_DESTRUCTION,
eLoc.clone().setDirection(r));

bounced = true;
}

You might also like