mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 19:50:37 +00:00
Migrated the RotateXZ Method
I moved the RotateXZ method from WaterWave to Methods.java in preparation of FireCombo.
This commit is contained in:
parent
03ee42a6a6
commit
0c3f357193
2 changed files with 14 additions and 11 deletions
|
@ -1994,6 +1994,18 @@ public class Methods {
|
||||||
}
|
}
|
||||||
return null;
|
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) {
|
public static int getMaxPresets(Player player) {
|
||||||
if (player.isOp()) return 500;
|
if (player.isOp()) return 500;
|
||||||
|
|
|
@ -218,10 +218,10 @@ public class WaterWave
|
||||||
{
|
{
|
||||||
double rotateSpeed = 45;
|
double rotateSpeed = 45;
|
||||||
revertBlocks();
|
revertBlocks();
|
||||||
direction = rotateXZ(direction, rotateSpeed);
|
direction = Methods.rotateXZ(direction, rotateSpeed);
|
||||||
for(double i = 0; i < theta; i+=increment)
|
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);
|
dir.setY(0);
|
||||||
Block block = player.getEyeLocation().add(dir).getBlock();
|
Block block = player.getEyeLocation().add(dir).getBlock();
|
||||||
currentLoc = block.getLocation();
|
currentLoc = block.getLocation();
|
||||||
|
@ -317,13 +317,4 @@ public class WaterWave
|
||||||
}
|
}
|
||||||
return false;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue