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.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import xyz.soper.arty.Artillery;
|
import xyz.soper.arty.Artillery;
|
||||||
|
import xyz.soper.arty.util.ArtyMath;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
@ -56,16 +57,26 @@ public class Mortar {
|
||||||
Nameable brewingStandMortar = (Nameable) mortar.getState();
|
Nameable brewingStandMortar = (Nameable) mortar.getState();
|
||||||
String mortarName = brewingStandMortar.getCustomName();
|
String mortarName = brewingStandMortar.getCustomName();
|
||||||
|
|
||||||
if(block.hasMetadata("direction_x")){
|
// if(block.hasMetadata("direction_x")){
|
||||||
float x = this.getBlock().getMetadata("direction_x").get(0).asFloat();
|
// float x = this.getBlock().getMetadata("direction_x").get(0).asFloat();
|
||||||
float y = this.getBlock().getMetadata("direction_y").get(0).asFloat();
|
// float y = this.getBlock().getMetadata("direction_y").get(0).asFloat();
|
||||||
float z = this.getBlock().getMetadata("direction_z").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{
|
if(block.hasMetadata("elevation_angle")){
|
||||||
setDirection(1,1,1);
|
elevation = this.getBlock().getMetadata("elevation_angle").get(0).asDouble();
|
||||||
}
|
}
|
||||||
|
setDirection(ArtyMath.calculateVector(elevation, direction));
|
||||||
|
|
||||||
if(mortarName.equals(BASIC_MORTAR_NAME)){
|
if(mortarName.equals(BASIC_MORTAR_NAME)){
|
||||||
failMultiplier = 25;
|
failMultiplier = 25;
|
||||||
|
|
|
@ -21,8 +21,6 @@ public class MortarHandler {
|
||||||
* @param shooter
|
* @param shooter
|
||||||
*/
|
*/
|
||||||
public static void fireShell(Mortar mortar, Shell shell, ProjectileSource 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);
|
Location topOfMortar = mortar.getBlock().getLocation().add(.5, 1, .5);
|
||||||
mortar.getBlock().getWorld().playSound(
|
mortar.getBlock().getWorld().playSound(
|
||||||
mortar.getBlock().getLocation(),
|
mortar.getBlock().getLocation(),
|
||||||
|
@ -66,7 +64,7 @@ public class MortarHandler {
|
||||||
// * @param shooter
|
// * @param shooter
|
||||||
// */
|
// */
|
||||||
// public static void fireShell(Mortar mortar, Shell shell, ProjectileSource 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.
|
// //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();
|
// Vector debugVector = new Vector(1, 1, 0).normalize();
|
||||||
|
|
Loading…
Reference in New Issue