mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-08-16 16:37:07 +00:00
Fixes for IceSpike
• Fixed Flooding with Bottlebending • Fixed IcePillar not working on single click • Fixed IcePillars not working on packed ice • Reduced sounds created by IcePillarField (it was painful)
This commit is contained in:
parent
e16ccecf3f
commit
4e5a268e4f
|
@ -202,12 +202,13 @@ public abstract class WaterAbility extends ElementalAbility {
|
|||
continue;
|
||||
} else if (isWaterbendable(player, null, block) && (!isPlant(block) || plantbending)) {
|
||||
if (TempBlock.isTempBlock(block)) {
|
||||
TempBlock tb = TempBlock.get(block);
|
||||
continue;
|
||||
/*TempBlock tb = TempBlock.get(block);
|
||||
byte full = 0x0;
|
||||
if (tb.getState().getRawData() != full
|
||||
&& (tb.getState().getType() != Material.WATER || tb.getState().getType() != Material.STATIONARY_WATER)) {
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
return block;
|
||||
}
|
||||
|
@ -228,11 +229,7 @@ public abstract class WaterAbility extends ElementalAbility {
|
|||
|
||||
public static boolean isIcebendable(Player player, Material material, boolean onlyIce) {
|
||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||
if(onlyIce) {
|
||||
return bPlayer == null ? null : isIce(material) && bPlayer.canIcebend() && isIce(material);
|
||||
} else {
|
||||
return bPlayer == null ? null : isIce(material) && bPlayer.canIcebend();
|
||||
}
|
||||
return bPlayer == null ? null : isIce(material) && bPlayer.canIcebend() && (!onlyIce || material == Material.ICE);
|
||||
}
|
||||
|
||||
public static boolean isPlantbendable(Player player, Material material, boolean onlyLeaves) {
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.bukkit.block.Block;
|
|||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
@ -41,7 +42,6 @@ public class IceSpikeBlast extends IceAbility {
|
|||
private Location firstDestination;
|
||||
private Location destination;
|
||||
private TempBlock source;
|
||||
private TempBlock originalSource;
|
||||
|
||||
public IceSpikeBlast(Player player) {
|
||||
super(player);
|
||||
|
@ -203,7 +203,8 @@ public class IceSpikeBlast extends IceAbility {
|
|||
sourceBlock = block;
|
||||
source = new TempBlock(sourceBlock, Material.ICE, data);
|
||||
} else if (prepared) {
|
||||
playFocusWaterEffect(sourceBlock);
|
||||
if (sourceBlock != null)
|
||||
playFocusWaterEffect(sourceBlock);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,11 +222,10 @@ public class IceSpikeBlast extends IceAbility {
|
|||
}
|
||||
progressing = false;
|
||||
}
|
||||
originalSource.revertBlock();
|
||||
}
|
||||
|
||||
private void returnWater() {
|
||||
new WaterReturn(player, sourceBlock);
|
||||
new WaterReturn(player, location.getBlock());
|
||||
}
|
||||
|
||||
private void throwIce() {
|
||||
|
@ -257,12 +257,12 @@ public class IceSpikeBlast extends IceAbility {
|
|||
settingUp = true;
|
||||
prepared = false;
|
||||
|
||||
if (isPlant(sourceBlock)) {
|
||||
/*if (isPlant(sourceBlock)) {
|
||||
new PlantRegrowth(player, sourceBlock);
|
||||
sourceBlock.setType(Material.AIR);
|
||||
}
|
||||
|
||||
originalSource = new TempBlock(sourceBlock, Material.AIR, data);
|
||||
originalSource = new TempBlock(sourceBlock, Material.AIR, data);*/
|
||||
}
|
||||
|
||||
public static void activate(Player player) {
|
||||
|
@ -382,16 +382,19 @@ public class IceSpikeBlast extends IceAbility {
|
|||
return;
|
||||
}
|
||||
|
||||
MaterialData data = block.getState().getData();
|
||||
block.setType(Material.WATER);
|
||||
block.setData((byte) 0x0);
|
||||
block.setData((byte)0);
|
||||
IceSpikeBlast iceSpike = new IceSpikeBlast(player);
|
||||
iceSpike.throwIce();
|
||||
iceSpike.sourceBlock = null;
|
||||
|
||||
if (iceSpike.progressing) {
|
||||
WaterReturn.emptyWaterBottle(player);
|
||||
} else {
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
block.setType(data.getItemType());
|
||||
block.setData(data.getData());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.bukkit.util.Vector;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class IceSpikePillar extends IceAbility {
|
||||
|
@ -46,6 +47,7 @@ public class IceSpikePillar extends IceAbility {
|
|||
private Vector direction;
|
||||
private ConcurrentHashMap<Block, Block> affectedBlocks;
|
||||
private ArrayList<LivingEntity> damaged;
|
||||
protected boolean inField = false;
|
||||
|
||||
public IceSpikePillar(Player player) {
|
||||
super(player);
|
||||
|
@ -107,7 +109,7 @@ public class IceSpikePillar extends IceAbility {
|
|||
|
||||
loadAffectedBlocks();
|
||||
|
||||
if (block.getType() == Material.ICE) {
|
||||
if (isIcebendable(block)) {
|
||||
if (canInstantiate()) {
|
||||
start();
|
||||
time = System.currentTimeMillis() - interval;
|
||||
|
@ -161,7 +163,7 @@ public class IceSpikePillar extends IceAbility {
|
|||
}
|
||||
|
||||
private boolean canInstantiate() {
|
||||
if (block.getType() != Material.ICE) {
|
||||
if (!isIcebendable(block.getType())) {
|
||||
return false;
|
||||
}
|
||||
for (Block block : affectedBlocks.keySet()) {
|
||||
|
@ -179,7 +181,7 @@ public class IceSpikePillar extends IceAbility {
|
|||
if (System.currentTimeMillis() - time >= interval) {
|
||||
time = System.currentTimeMillis();
|
||||
if (progress < height) {
|
||||
moveEarth();
|
||||
risePillar();
|
||||
removeTimestamp = System.currentTimeMillis();
|
||||
} else {
|
||||
if (removeTimestamp != 0 && removeTimestamp + removeTimer <= System.currentTimeMillis()) {
|
||||
|
@ -193,7 +195,7 @@ public class IceSpikePillar extends IceAbility {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean moveEarth() {
|
||||
private boolean risePillar() {
|
||||
progress++;
|
||||
Block affectedBlock = location.clone().add(direction).getBlock();
|
||||
location = location.add(direction);
|
||||
|
@ -210,7 +212,9 @@ public class IceSpikePillar extends IceAbility {
|
|||
}
|
||||
|
||||
affectedBlock.setType(Material.ICE);
|
||||
playIcebendingSound(block.getLocation());
|
||||
if (!inField || new Random().nextInt((int) ((height + 1) * 1.5)) == 0) {
|
||||
playIcebendingSound(block.getLocation());
|
||||
}
|
||||
loadAffectedBlocks();
|
||||
|
||||
if (location.distanceSquared(origin) >= height * height) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.waterbending;
|
|||
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ability.IceAbility;
|
||||
import com.projectkorra.projectkorra.ability.WaterAbility;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -46,15 +47,15 @@ public class IceSpikePillarField extends IceAbility {
|
|||
for (int x = (int) -(radius - 1); x <= (radius - 1); x++) {
|
||||
for (int z = (int) -(radius - 1); z <= (radius - 1); z++) {
|
||||
for (int y = -1; y <= 1; y++) {
|
||||
Block testBlock = player.getWorld().getBlockAt(locX + x, locY + y, locZ + z);
|
||||
Block testBlock = player.getWorld().getBlockAt(locX + x, locY + y, locZ + z);
|
||||
|
||||
if (testBlock.getType() == Material.ICE
|
||||
if (WaterAbility.isIcebendable(player, testBlock.getType(), false)
|
||||
&& testBlock.getRelative(BlockFace.UP).getType() == Material.AIR
|
||||
&& !(testBlock.getX() == player.getEyeLocation().getBlock().getX()
|
||||
&& testBlock.getZ() == player.getEyeLocation().getBlock().getZ())) {
|
||||
iceBlocks.add(testBlock);
|
||||
for(Block iceBlockForSound : iceBlocks) {
|
||||
playIcebendingSound(iceBlockForSound.getLocation());
|
||||
for (int i = 0; i < iceBlocks.size() / 2 + 1; i++) {
|
||||
playIcebendingSound(iceBlocks.get(i).getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +91,8 @@ public class IceSpikePillarField extends IceAbility {
|
|||
}
|
||||
|
||||
if (targetBlock.getRelative(BlockFace.UP).getType() != Material.ICE) {
|
||||
new IceSpikePillar(player, targetBlock.getLocation(), (int) damage, thrownForce, cooldown);
|
||||
IceSpikePillar pillar = new IceSpikePillar(player, targetBlock.getLocation(), (int) damage, thrownForce, cooldown);
|
||||
pillar.inField = true;
|
||||
bPlayer.addCooldown("IceSpikePillarField", cooldown);
|
||||
iceBlocks.remove(targetBlock);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue