deprecated direction vector method for mortar

master
Soper Aylamo 2021-05-28 14:45:31 -04:00
parent 05e0a1c934
commit c93696c628
2 changed files with 22 additions and 0 deletions

View File

@ -79,6 +79,9 @@ public class MortarInteract implements Listener {
Vector horizonVector = new Vector(playerDirection.getX(), 0, playerDirection.getZ());
Mortar.setMortarDirection(linkedMortar, horizonVector);
player.sendMessage(ChatColor.GOLD + "Mortar is now pointing towards " + horizonVector.getX() + ", " + horizonVector.getZ());
player.sendMessage("DEBUG: Angle is " + (180*horizonVector.angle(new Vector(1,0,0))/Math.PI));
}
else if(event.getAction() == Action.RIGHT_CLICK_AIR){

View File

@ -200,6 +200,13 @@ public class Mortar {
&& isStringMortar(((Nameable) block.getState()).getCustomName());
}
/**
* Adjusts a block's directional metadata.
* @param block Block that represents a mortar.
* @param direction Directional vector.
* @deprecated This function has been deprecated in favor of the angle-based setElevation and setDirection angles.
*/
@Deprecated
public static void setMortarDirection(Block block, Vector direction){
if(isMortar(block)){
if(direction.getY() == 0){
@ -211,6 +218,18 @@ public class Mortar {
else throw new IllegalArgumentException("Cannot set non-mortar block's directional MetaData");
}
/**
*
* @param angle
*/
public static void setElevationAngle(double angle){
//TODO: setElevationAngle method
}
public static void setDirectionAngle(double angle){
//TODO: setDirectionAngle method
}
private static boolean isStringMortar(String string){
if(string == null){
return false;