mortar now fires in an adjustable direction
parent
655b3e1850
commit
e831765783
|
@ -8,6 +8,7 @@ import org.bukkit.metadata.FixedMetadataValue;
|
|||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.util.Vector;
|
||||
import xyz.soper.arty.Artillery;
|
||||
import xyz.soper.arty.util.ArtyMath;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -56,16 +57,26 @@ public class Mortar {
|
|||
Nameable brewingStandMortar = (Nameable) mortar.getState();
|
||||
String mortarName = brewingStandMortar.getCustomName();
|
||||
|
||||
if(block.hasMetadata("direction_x")){
|
||||
float x = this.getBlock().getMetadata("direction_x").get(0).asFloat();
|
||||
float y = this.getBlock().getMetadata("direction_y").get(0).asFloat();
|
||||
float z = this.getBlock().getMetadata("direction_z").get(0).asFloat();
|
||||
// if(block.hasMetadata("direction_x")){
|
||||
// float x = this.getBlock().getMetadata("direction_x").get(0).asFloat();
|
||||
// float y = this.getBlock().getMetadata("direction_y").get(0).asFloat();
|
||||
// float z = this.getBlock().getMetadata("direction_z").get(0).asFloat();
|
||||
//
|
||||
// setDirection(x, y, z);
|
||||
// }
|
||||
// else{
|
||||
// setDirection(1,1,1);
|
||||
// }
|
||||
|
||||
setDirection(x, y, z);
|
||||
double direction = 0;
|
||||
double elevation = (60/180)*Math.PI;
|
||||
if(block.hasMetadata("direction_angle")){
|
||||
direction = this.getBlock().getMetadata("direction_angle").get(0).asDouble();
|
||||
}
|
||||
else{
|
||||
setDirection(1,1,1);
|
||||
if(block.hasMetadata("elevation_angle")){
|
||||
elevation = this.getBlock().getMetadata("elevation_angle").get(0).asDouble();
|
||||
}
|
||||
setDirection(ArtyMath.calculateVector(elevation, direction));
|
||||
|
||||
if(mortarName.equals(BASIC_MORTAR_NAME)){
|
||||
failMultiplier = 25;
|
||||
|
|
|
@ -21,8 +21,6 @@ public class MortarHandler {
|
|||
* @param shooter
|
||||
*/
|
||||
public static void fireShell(Mortar mortar, Shell shell, ProjectileSource shooter){
|
||||
//TODO: Create a way to modify the mortar's direction vector.
|
||||
//It currently cannot fire an arrow because it does not exist.
|
||||
Location topOfMortar = mortar.getBlock().getLocation().add(.5, 1, .5);
|
||||
mortar.getBlock().getWorld().playSound(
|
||||
mortar.getBlock().getLocation(),
|
||||
|
@ -66,7 +64,7 @@ public class MortarHandler {
|
|||
// * @param shooter
|
||||
// */
|
||||
// public static void fireShell(Mortar mortar, Shell shell, ProjectileSource shooter){
|
||||
// //TODO: Use linkProjectile method and finalize fireShell method to create a proper non-debug fireShell method.
|
||||
// //Use linkProjectile method and finalize fireShell method to create a proper non-debug fireShell method.
|
||||
// //As it stands, this method creates a shell with no actual data so the Shell wrapper uses default values.
|
||||
//
|
||||
// Vector debugVector = new Vector(1, 1, 0).normalize();
|
||||
|
|
Loading…
Reference in New Issue