fireShell cannot fire with a non-existent directional vector
parent
44de70cb88
commit
05e0f30896
|
@ -15,38 +15,62 @@ public class MortarHandler {
|
||||||
* Fires a shell projectile from the specified mortar.
|
* Fires a shell projectile from the specified mortar.
|
||||||
* @param mortar
|
* @param mortar
|
||||||
* @param shell
|
* @param shell
|
||||||
*/
|
|
||||||
public static void fireShell(Mortar mortar, Shell shell){
|
|
||||||
//TODO: Fire shell method
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fires a shell projectile from the specified mortar by the specified shooter.
|
|
||||||
* @param mortar
|
|
||||||
* @param shell
|
|
||||||
* @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.
|
//TODO: Create a way to modify the mortar's direction vector.
|
||||||
//As it stands, this method creates a shell with no actual data so the Shell wrapper uses default values.
|
//It currently cannot fire an arrow because it does not exist.
|
||||||
|
Location topOfMortar = mortar.getBlock().getLocation().add(.5, 1, .5);
|
||||||
|
|
||||||
|
|
||||||
Vector debugVector = new Vector(1, 1, 0).normalize();
|
|
||||||
mortar.getBlock().getWorld().playSound(
|
mortar.getBlock().getWorld().playSound(
|
||||||
mortar.getBlock().getLocation(),
|
mortar.getBlock().getLocation(),
|
||||||
"entity.generic.explode",
|
"entity.generic.explode",
|
||||||
1,
|
1,
|
||||||
1.5F
|
1.5F
|
||||||
);
|
);
|
||||||
Location mortarLocation = mortar.getBlock().getLocation().add(.5, 1, .5);
|
Arrow shellProjectile = mortar.getBlock().getWorld().spawnArrow(
|
||||||
Arrow shellProjectile = mortar.getBlock().getWorld().spawn(mortarLocation, Arrow.class);
|
topOfMortar,
|
||||||
shellProjectile.setVelocity(debugVector.multiply(shell.baseVelocity));
|
mortar.getDirection(),
|
||||||
|
(float)(shell.baseVelocity*mortar.velocityMultiplier),
|
||||||
|
.1f
|
||||||
|
);
|
||||||
shellProjectile.setShooter(shooter);
|
shellProjectile.setShooter(shooter);
|
||||||
shellProjectile.setCustomName("shell");
|
shell.linkProjectile(shellProjectile);
|
||||||
mortar.getBlock().getWorld().spawnParticle(Particle.SMOKE_NORMAL, mortarLocation, 500, .5, 0, .5, .5);
|
mortar.getBlock().getWorld().spawnParticle(Particle.SMOKE_NORMAL,
|
||||||
|
topOfMortar,
|
||||||
|
500,
|
||||||
|
.5,
|
||||||
|
0,
|
||||||
|
.5,
|
||||||
|
.5
|
||||||
|
);
|
||||||
if(shooter instanceof Player)
|
if(shooter instanceof Player)
|
||||||
((Player) shooter).sendMessage("DEBUG: Shell fired with a velocity " + shell.baseVelocity);
|
((Player) shooter).sendMessage("DEBUG: Shell fired with a velocity " + shell.baseVelocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Fires a shell projectile from the specified mortar by the specified shooter.
|
||||||
|
// * @param mortar
|
||||||
|
// * @param shell
|
||||||
|
// * @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.
|
||||||
|
// //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();
|
||||||
|
// mortar.getBlock().getWorld().playSound(
|
||||||
|
// mortar.getBlock().getLocation(),
|
||||||
|
// "entity.generic.explode",
|
||||||
|
// 1,
|
||||||
|
// 1.5F
|
||||||
|
// );
|
||||||
|
// Location mortarLocation = mortar.getBlock().getLocation().add(.5, 1, .5);
|
||||||
|
// Arrow shellProjectile = mortar.getBlock().getWorld().spawnArrow(mortarLocation, debugVector, (float)shell.baseVelocity, 0f);
|
||||||
|
// shellProjectile.setShooter(shooter);
|
||||||
|
// shellProjectile.setCustomName("shell");
|
||||||
|
// mortar.getBlock().getWorld().spawnParticle(Particle.SMOKE_NORMAL, mortarLocation, 500, .5, 0, .5, .5);
|
||||||
|
// if(shooter instanceof Player)
|
||||||
|
// ((Player) shooter).sendMessage("DEBUG: Shell fired with a velocity " + shell.baseVelocity);
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue