mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
Various Fixes
* Fixed IceBlast Selection Bug * Added KnockBack to WallOfFire Also organized imports. * Fixed WallOfFire Knockback * Fixed Watermanip creating air pockets. Also organized imports. * Fixed surge wall removing leaves, also re-did my fix on WaterManipulation creating air pockets. I thought I tested my fix for watermanipulation really well, but I didn't test it as well as I thought, my bad. With my previous fix, it fixed watermanip's air pockets, but it would create waterblocks if used from a waterbottle, this is now fixed. * Changed addWater to a non-static method, also changed player to non-static. * Changed Extraction to be a metal ability. * Fixed WaterManipulation for sure this time. Sorry for all of the fails before, I would fix a problem, then another one would arise. This has been test, and I haven't found any new issues, and I have fixed the previous ones.
This commit is contained in:
parent
3ac4736e44
commit
91bb27882e
5 changed files with 82 additions and 69 deletions
|
@ -1,7 +1,7 @@
|
|||
package com.projectkorra.projectkorra.earthbending;
|
||||
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ability.EarthAbility;
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -9,10 +9,10 @@ import org.bukkit.block.Block;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ability.MetalAbility;
|
||||
|
||||
public class Extraction extends EarthAbility {
|
||||
public class Extraction extends MetalAbility {
|
||||
|
||||
private int doubleChance;
|
||||
private int tripleChance;
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
package com.projectkorra.projectkorra.firebending;
|
||||
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||
import com.projectkorra.projectkorra.util.DamageHandler;
|
||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||
import com.projectkorra.projectkorra.util.TempBlock;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
|
@ -14,9 +11,12 @@ import org.bukkit.entity.LivingEntity;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||
import com.projectkorra.projectkorra.util.DamageHandler;
|
||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||
import com.projectkorra.projectkorra.util.TempBlock;
|
||||
|
||||
public class WallOfFire extends FireAbility {
|
||||
|
||||
|
@ -98,7 +98,7 @@ public class WallOfFire extends FireAbility {
|
|||
AirAbility.breakBreathbendingHold(entity);
|
||||
}
|
||||
entity.setFireTicks((int) (fireTicks * 20));
|
||||
GeneralMethods.setVelocity(entity, new Vector(0, 0, 0));
|
||||
entity.setVelocity(player.getLocation().getDirection().multiply(1.4));
|
||||
new FireDamageTimer(entity, player);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public class IceBlast extends IceAbility {
|
|||
|
||||
block(player);
|
||||
range = getNightFactor(range, player.getWorld());
|
||||
Block sourceBlock = BlockSource.getWaterSourceBlock(player, range, ClickType.SHIFT_DOWN, false, true, false);
|
||||
Block sourceBlock = BlockSource.getWaterSourceBlock(player, range, ClickType.SHIFT_DOWN, false, true, false, false, false);
|
||||
|
||||
if (sourceBlock == null) {
|
||||
return;
|
||||
|
|
|
@ -252,7 +252,7 @@ public class SurgeWall extends WaterAbility {
|
|||
} else if (!blocks.contains(block)
|
||||
&& (block.getType() == Material.AIR
|
||||
|| block.getType() == Material.FIRE
|
||||
|| isWaterbendable(block))) {
|
||||
|| isWaterbendable(block)) && isTransparent(block)) {
|
||||
WALL_BLOCKS.put(block, player);
|
||||
addWallBlock(block);
|
||||
blocks.add(block);
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
package com.projectkorra.projectkorra.waterbending;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ability.AirAbility;
|
||||
|
@ -14,19 +27,6 @@ import com.projectkorra.projectkorra.util.DamageHandler;
|
|||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||
import com.projectkorra.projectkorra.util.TempBlock;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class WaterManipulation extends WaterAbility {
|
||||
|
||||
private static final ConcurrentHashMap<Block, Block> AFFECTED_BLOCKS = new ConcurrentHashMap<>();
|
||||
|
@ -142,7 +142,8 @@ public class WaterManipulation extends WaterAbility {
|
|||
progressing = true;
|
||||
settingUp = true;
|
||||
firstDestination = getToEyeLevel();
|
||||
firstDirection = GeneralMethods.getDirection(sourceBlock.getLocation(), firstDestination).normalize();
|
||||
firstDirection = GeneralMethods.getDirection(sourceBlock.getLocation(), firstDestination)
|
||||
.normalize();
|
||||
targetDestination = GeneralMethods.getPointOnLine(firstDestination, targetDestination, range);
|
||||
targetDirection = GeneralMethods.getDirection(firstDestination, targetDestination).normalize();
|
||||
|
||||
|
@ -160,7 +161,8 @@ public class WaterManipulation extends WaterAbility {
|
|||
}
|
||||
|
||||
public boolean prepare() {
|
||||
Block block = BlockSource.getWaterSourceBlock(player, selectRange, ClickType.SHIFT_DOWN, true, true, bPlayer.canPlantbend());
|
||||
Block block = BlockSource.getWaterSourceBlock(player, selectRange, ClickType.SHIFT_DOWN, true, true,
|
||||
bPlayer.canPlantbend());
|
||||
cancelPrevious();
|
||||
block(player);
|
||||
|
||||
|
@ -312,7 +314,8 @@ public class WaterManipulation extends WaterAbility {
|
|||
trail = new TempBlock(sourceBlock, Material.STATIONARY_WATER, (byte) 1);
|
||||
sourceBlock = block;
|
||||
|
||||
if (location.distanceSquared(targetDestination) <= 1 || location.distanceSquared(firstDestination) > range * range) {
|
||||
if (location.distanceSquared(targetDestination) <= 1
|
||||
|| location.distanceSquared(firstDestination) > range * range) {
|
||||
falling = true;
|
||||
progressing = false;
|
||||
}
|
||||
|
@ -356,18 +359,22 @@ public class WaterManipulation extends WaterAbility {
|
|||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static void addWater(Block block) {
|
||||
if (!isWater(block)) {
|
||||
if (!AFFECTED_BLOCKS.containsKey(block)) {
|
||||
AFFECTED_BLOCKS.put(block, block);
|
||||
}
|
||||
if (PhaseChangeFreeze.getFrozenBlocks().containsKey(block)) {
|
||||
PhaseChangeFreeze.getFrozenBlocks().remove(block);
|
||||
}
|
||||
if (isWater(block)) {
|
||||
ParticleEffect.WATER_BUBBLE.display((float) Math.random(), (float) Math.random(),
|
||||
(float) Math.random(), 0f, 5, block.getLocation().clone().add(.5,.5,.5), 257D);
|
||||
}
|
||||
block.setType(Material.STATIONARY_WATER);
|
||||
block.setData((byte) 0);
|
||||
} else {
|
||||
if (isWater(block) && !AFFECTED_BLOCKS.containsKey(block)) {
|
||||
ParticleEffect.WATER_BUBBLE.display((float) Math.random(), (float) Math.random(), (float) Math.random(), 0f,
|
||||
5, block.getLocation().clone().add(.5, .5, .5), 257D);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean annihilateBlasts(Location location, double radius, Player player) {
|
||||
|
@ -398,7 +405,8 @@ public class WaterManipulation extends WaterAbility {
|
|||
Location mloc = manip.location;
|
||||
if (mloc.distanceSquared(location) <= manip.selectRange * manip.selectRange
|
||||
&& GeneralMethods.getDistanceFromLine(vector, location, manip.location) < manip.deflectRange
|
||||
&& mloc.distanceSquared(location.clone().add(vector)) < mloc.distanceSquared(location.clone().add(vector.clone().multiply(-1)))) {
|
||||
&& mloc.distanceSquared(location.clone().add(vector)) < mloc
|
||||
.distanceSquared(location.clone().add(vector.clone().multiply(-1)))) {
|
||||
manip.remove();
|
||||
}
|
||||
}
|
||||
|
@ -463,7 +471,8 @@ public class WaterManipulation extends WaterAbility {
|
|||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||
if (bPlayer == null) {
|
||||
return;
|
||||
} if (bPlayer.isOnCooldown("WaterManipulation")) {
|
||||
}
|
||||
if (bPlayer.isOnCooldown("WaterManipulation")) {
|
||||
redirectTargettedBlasts(player);
|
||||
return;
|
||||
}
|
||||
|
@ -482,6 +491,9 @@ public class WaterManipulation extends WaterAbility {
|
|||
if (!handledPrepare && WaterReturn.hasWaterBottle(player)) {
|
||||
Location eyeLoc = player.getEyeLocation();
|
||||
Block block = eyeLoc.add(eyeLoc.getDirection().normalize()).getBlock();
|
||||
if (!AFFECTED_BLOCKS.containsKey(block)) {
|
||||
AFFECTED_BLOCKS.put(block, block);
|
||||
}
|
||||
|
||||
if (isTransparent(player, block) && isTransparent(player, eyeLoc.getBlock())) {
|
||||
if (getTargetLocation(player, range).distanceSquared(block.getLocation()) > 1) {
|
||||
|
@ -520,7 +532,8 @@ public class WaterManipulation extends WaterAbility {
|
|||
Location mloc = manip.location;
|
||||
if (mloc.distanceSquared(location) <= manip.selectRange * manip.selectRange
|
||||
&& GeneralMethods.getDistanceFromLine(vector, location, manip.location) < manip.deflectRange
|
||||
&& mloc.distanceSquared(location.clone().add(vector)) < mloc.distanceSquared(location.clone().add(vector.clone().multiply(-1)))) {
|
||||
&& mloc.distanceSquared(location.clone().add(vector)) < mloc
|
||||
.distanceSquared(location.clone().add(vector.clone().multiply(-1)))) {
|
||||
manip.redirect(player, getTargetLocation(player, manip.selectRange));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue