Migrated the RotateXZ Method

I moved the RotateXZ method from WaterWave to Methods.java in
preparation of FireCombo.
This commit is contained in:
nathank33 2014-09-27 11:03:27 -07:00
parent 03ee42a6a6
commit 0c3f357193
2 changed files with 14 additions and 11 deletions

View file

@ -1994,6 +1994,18 @@ public class Methods {
}
return null;
}
public static Vector rotateXZ(Vector vec, double theta)
{
/**
* Rotates a vector around the Y plane.
*/
Vector vec2 = vec.clone();
double x = vec2.getX();
double z = vec2.getZ();
vec2.setX(x * Math.cos(Math.toRadians(theta)) - z * Math.sin(Math.toRadians(theta)));
vec2.setZ(x * Math.sin(Math.toRadians(theta)) + z * Math.cos(Math.toRadians(theta)));
return vec2;
}
public static int getMaxPresets(Player player) {
if (player.isOp()) return 500;

View file

@ -218,10 +218,10 @@ public class WaterWave
{
double rotateSpeed = 45;
revertBlocks();
direction = rotateXZ(direction, rotateSpeed);
direction = Methods.rotateXZ(direction, rotateSpeed);
for(double i = 0; i < theta; i+=increment)
{
Vector dir = rotateXZ(direction, i - theta / 2).normalize().multiply(radius);
Vector dir = Methods.rotateXZ(direction, i - theta / 2).normalize().multiply(radius);
dir.setY(0);
Block block = player.getEyeLocation().add(dir).getBlock();
currentLoc = block.getLocation();
@ -317,13 +317,4 @@ public class WaterWave
}
return false;
}
public static Vector rotateXZ(Vector vec, double theta)
{
Vector vec2 = vec.clone();
double x = vec2.getX();
double z = vec2.getZ();
vec2.setX(x * Math.cos(Math.toRadians(theta)) - z * Math.sin(Math.toRadians(theta)));
vec2.setZ(x * Math.sin(Math.toRadians(theta)) + z * Math.cos(Math.toRadians(theta)));
return vec2;
}
}