mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-22 16:05:01 +00:00
Fix Spout movement and Multiability/Combo loading (#588)
* Fix Spout movement and Multiability/Combo loading * Fix Spout movement * Fix Spout movement
This commit is contained in:
parent
aa2f4f51fa
commit
df273dce6e
3 changed files with 47 additions and 44 deletions
|
@ -300,8 +300,7 @@ public class PKListener implements Listener {
|
|||
|
||||
Block block = event.getBlock();
|
||||
|
||||
if (!WaterManipulation.canPhysicsChange(block) || !EarthPassive.canPhysicsChange(block)
|
||||
|| Illumination.getBlocks().containsKey(block) || EarthAbility.getPreventPhysicsBlocks().contains(block)) {
|
||||
if (!WaterManipulation.canPhysicsChange(block) || !EarthPassive.canPhysicsChange(block) || Illumination.getBlocks().containsKey(block) || EarthAbility.getPreventPhysicsBlocks().contains(block)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
@ -1089,22 +1088,22 @@ public class PKListener implements Listener {
|
|||
return;
|
||||
}
|
||||
|
||||
else if (CoreAbility.hasAbility(player, WaterSpout.class) || CoreAbility.hasAbility(player, AirSpout.class) || CoreAbility.hasAbility(player, SandSpout.class)) {
|
||||
Vector vel = new Vector();
|
||||
vel.setX(event.getTo().getX() - event.getFrom().getX());
|
||||
vel.setY(event.getTo().getY() - event.getFrom().getY());
|
||||
vel.setZ(event.getTo().getZ() - event.getFrom().getZ());
|
||||
// You now know the old velocity. Set to match recommended velocity
|
||||
double currspeed = vel.length();
|
||||
double maxspeed = .15;
|
||||
if (currspeed > maxspeed) {
|
||||
// only if moving set a factor
|
||||
vel = vel.normalize().multiply(maxspeed);
|
||||
// apply the new velocity (MAY REQUIRE A SCHEDULED TASK
|
||||
// INSTEAD!)
|
||||
event.getPlayer().setVelocity(vel);
|
||||
}
|
||||
}
|
||||
// else if (CoreAbility.hasAbility(player, WaterSpout.class) || CoreAbility.hasAbility(player, AirSpout.class) || CoreAbility.hasAbility(player, SandSpout.class)) {
|
||||
// Vector vel = new Vector();
|
||||
// vel.setX(event.getTo().getX() - event.getFrom().getX());
|
||||
// vel.setY(event.getTo().getY() - event.getFrom().getY());
|
||||
// vel.setZ(event.getTo().getZ() - event.getFrom().getZ());
|
||||
// // You now know the old velocity. Set to match recommended velocity
|
||||
// double currspeed = vel.length();
|
||||
// double maxspeed = .15;
|
||||
// if (currspeed > maxspeed) {
|
||||
// // only if moving set a factor
|
||||
// vel = vel.normalize().multiply(maxspeed);
|
||||
// // apply the new velocity (MAY REQUIRE A SCHEDULED TASK
|
||||
// // INSTEAD!)
|
||||
// event.getPlayer().setVelocity(vel);
|
||||
// }
|
||||
// }
|
||||
|
||||
else if (Bloodbending.isBloodbent(player)) {
|
||||
double distance1, distance2;
|
||||
|
|
|
@ -54,11 +54,11 @@ public class ProjectKorra extends JavaPlugin {
|
|||
|
||||
new ConfigManager();
|
||||
new GeneralMethods(this);
|
||||
CoreAbility.registerAbilities();
|
||||
updater = new Updater(this, "http://projectkorra.com/forum/forums/dev-builds.16/index.rss");
|
||||
new Commands(this);
|
||||
new MultiAbilityManager();
|
||||
new ComboManager();
|
||||
CoreAbility.registerAbilities();
|
||||
|
||||
Preset.loadExternalPresets();
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class WaterSpout extends WaterAbility {
|
|||
return;
|
||||
}
|
||||
|
||||
Block topBlock = GeneralMethods.getTopBlock(player.getLocation(), (int)-getNightFactor(height), (int)-getNightFactor(height));
|
||||
Block topBlock = GeneralMethods.getTopBlock(player.getLocation(), (int) -getNightFactor(height), (int) -getNightFactor(height));
|
||||
if (topBlock == null) {
|
||||
topBlock = player.getLocation().getBlock();
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ public class WaterSpout extends WaterAbility {
|
|||
double angle = (i * Math.PI / 180);
|
||||
double x = 1 * Math.cos(angle + rotation);
|
||||
double z = 1 * Math.sin(angle + rotation);
|
||||
|
||||
Location loc = location.clone().getBlock().getLocation().add(.5, .5, .5);
|
||||
loc.add(x, height, z);
|
||||
|
||||
|
@ -121,11 +122,12 @@ public class WaterSpout extends WaterAbility {
|
|||
blocks.clear();
|
||||
player.setFallDistance(0);
|
||||
player.setSprinting(false);
|
||||
if ((new Random()).nextInt(4) == 0) {
|
||||
if ((new Random()).nextInt(10) == 0) {
|
||||
playWaterbendingSound(player.getLocation());
|
||||
}
|
||||
|
||||
player.removePotionEffect(PotionEffectType.SPEED);
|
||||
|
||||
Location location = player.getLocation().clone().add(0, .2, 0);
|
||||
Block block = location.clone().getBlock();
|
||||
double height = spoutableWaterHeight(location);
|
||||
|
@ -137,8 +139,8 @@ public class WaterSpout extends WaterAbility {
|
|||
remove();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 1; i <= height; i++) {
|
||||
|
||||
block = location.clone().add(0, i, 0).getBlock();
|
||||
|
||||
if (!TempBlock.isTempBlock(block)) {
|
||||
|
@ -203,6 +205,7 @@ public class WaterSpout extends WaterAbility {
|
|||
|
||||
Location location = block.getLocation();
|
||||
Location playerLoc = player.getLocation();
|
||||
|
||||
location = new Location(location.getWorld(), playerLoc.getX(), location.getY(), playerLoc.getZ());
|
||||
|
||||
double dy = playerLoc.getY() - block.getY();
|
||||
|
@ -238,6 +241,7 @@ public class WaterSpout extends WaterAbility {
|
|||
Block blocki;
|
||||
|
||||
for (int i = 0; i < maxHeight; i++) {
|
||||
|
||||
blocki = location.clone().add(0, -i, 0).getBlock();
|
||||
if (GeneralMethods.isRegionProtectedFromBuild(this, blocki.getLocation())) {
|
||||
return -1;
|
||||
|
|
Loading…
Reference in a new issue