mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-22 16:05:01 +00:00
Fixed WaterSpout & SurgeWave bugs (#537)
* Fixed your own water manips breaking spout * Fixed Surge wave freeze from not reverting ice to water Surge wave now reverts the ice blocks back to water if they were originally water :)))))
This commit is contained in:
parent
e93395f71e
commit
2ef30d15d7
2 changed files with 17 additions and 17 deletions
|
@ -44,7 +44,7 @@ public class SurgeWave extends WaterAbility {
|
|||
private Location frozenLocation;
|
||||
private Vector targetDirection;
|
||||
private ConcurrentHashMap<Block, Block> waveBlocks;
|
||||
private ConcurrentHashMap<Block, Block> frozenBlocks;
|
||||
private ConcurrentHashMap<Block, Material> frozenBlocks;
|
||||
|
||||
public SurgeWave(Player player) {
|
||||
super(player);
|
||||
|
@ -137,17 +137,15 @@ public class SurgeWave extends WaterAbility {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (block.getType() == Material.AIR || block.getType() == Material.SNOW) {
|
||||
Block oldBlock = block;
|
||||
if (block.getType() == Material.AIR || block.getType() == Material.SNOW || isWater(block)) {
|
||||
new TempBlock(block, Material.ICE, (byte) 0);
|
||||
frozenBlocks.put(block, block);
|
||||
}
|
||||
if (isWater(block)) {
|
||||
PhaseChangeFreeze.freeze(player, block);
|
||||
frozenBlocks.put(block, oldBlock.getType());
|
||||
}
|
||||
if (isPlant(block) && block.getType() != Material.LEAVES) {
|
||||
block.breakNaturally();
|
||||
new TempBlock(block, Material.ICE, (byte) 0);
|
||||
frozenBlocks.put(block, block);
|
||||
frozenBlocks.put(block, oldBlock.getType());
|
||||
}
|
||||
for (Block sound : frozenBlocks.keySet()) {
|
||||
if ((new Random()).nextInt(4) == 0) {
|
||||
|
@ -364,7 +362,7 @@ public class SurgeWave extends WaterAbility {
|
|||
|
||||
private void thaw() {
|
||||
for (Block block : frozenBlocks.keySet()) {
|
||||
TempBlock.revertBlock(block, Material.AIR);
|
||||
TempBlock.revertBlock(block, frozenBlocks.get(block));
|
||||
frozenBlocks.remove(block);
|
||||
}
|
||||
}
|
||||
|
@ -571,7 +569,7 @@ public class SurgeWave extends WaterAbility {
|
|||
return waveBlocks;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<Block, Block> getFrozenBlocks() {
|
||||
public ConcurrentHashMap<Block, Material> getFrozenBlocks() {
|
||||
return frozenBlocks;
|
||||
}
|
||||
|
||||
|
|
|
@ -280,14 +280,16 @@ public class WaterSpout extends WaterAbility {
|
|||
public static boolean removeSpouts(Location loc0, double radius, Player sourcePlayer) {
|
||||
boolean removed = false;
|
||||
for (WaterSpout spout : getAbilities(WaterSpout.class)) {
|
||||
Location top = spout.getLocation();
|
||||
Location base = spout.getBase().getLocation();
|
||||
double dist = top.getBlockY() - base.getBlockY();
|
||||
for (double d = 0; d <= dist; d += 0.5) {
|
||||
Location spoutl = base.clone().add(0, d, 0);
|
||||
if (loc0.distance(spoutl) <= radius) {
|
||||
removed = true;
|
||||
spout.remove();
|
||||
if (!spout.player.equals(sourcePlayer)) {
|
||||
Location top = spout.getLocation();
|
||||
Location base = spout.getBase().getLocation();
|
||||
double dist = top.getBlockY() - base.getBlockY();
|
||||
for (double d = 0; d <= dist; d += 0.5) {
|
||||
Location spoutl = base.clone().add(0, d, 0);
|
||||
if (loc0.distance(spoutl) <= radius) {
|
||||
removed = true;
|
||||
spout.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue