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