mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
parent
fa112163df
commit
030a241a60
2 changed files with 34 additions and 3 deletions
|
@ -1093,6 +1093,32 @@ public class GeneralMethods {
|
||||||
return blockHolder;
|
return blockHolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Block getBottomBlock(Location loc, int positiveY, int negativeY) {
|
||||||
|
Block blockHolder = loc.getBlock();
|
||||||
|
int y = 0;
|
||||||
|
//Only one of these while statements will go
|
||||||
|
while (blockHolder.getType() != Material.AIR && Math.abs(y) < Math.abs(negativeY)) {
|
||||||
|
y--;
|
||||||
|
Block tempblock = loc.clone().add(0, y, 0).getBlock();
|
||||||
|
if (tempblock.getType() == Material.AIR) {
|
||||||
|
return blockHolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockHolder = tempblock;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (blockHolder.getType() != Material.AIR && Math.abs(y) < Math.abs(positiveY)) {
|
||||||
|
y++;
|
||||||
|
blockHolder = loc.clone().add(0, y, 0).getBlock();
|
||||||
|
if (blockHolder.getType() == Material.AIR) {
|
||||||
|
return blockHolder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return blockHolder;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean hasItems() {
|
public static boolean hasItems() {
|
||||||
return Bukkit.getServer().getPluginManager().getPlugin("ProjectKorraItems") != null;
|
return Bukkit.getServer().getPluginManager().getPlugin("ProjectKorraItems") != null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -321,7 +321,11 @@ public class LavaFlow extends LavaAbility {
|
||||||
for (double x = -radius; x <= radius; x++) {
|
for (double x = -radius; x <= radius; x++) {
|
||||||
for (double z = -radius; z <= radius; z++) {
|
for (double z = -radius; z <= radius; z++) {
|
||||||
Location loc = origin.clone().add(x, 0, z);
|
Location loc = origin.clone().add(x, 0, z);
|
||||||
Block tempBlock = GeneralMethods.getTopBlock(loc, upwardFlow, downwardFlow);
|
Block tempBlock_t = GeneralMethods.getTopBlock(loc, upwardFlow, downwardFlow);
|
||||||
|
Block tempBlock_b = GeneralMethods.getBottomBlock(loc, upwardFlow, downwardFlow);
|
||||||
|
Block tempBlock = tempBlock_t;
|
||||||
|
if (tempBlock_t.getLocation().distance(player.getLocation()) > tempBlock_b.getLocation().distance(player.getLocation()))
|
||||||
|
tempBlock = tempBlock_b;
|
||||||
if (tempBlock == null) {
|
if (tempBlock == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -396,12 +400,13 @@ public class LavaFlow extends LavaAbility {
|
||||||
affectedBlocks.add(tb);
|
affectedBlocks.add(tb);
|
||||||
} else return;
|
} else return;
|
||||||
}
|
}
|
||||||
TempBlock tblock = new TempBlock(block, Material.STATIONARY_LAVA, (byte) 0);
|
TempBlock tblock = new TempBlock(block, Material.LAVA, (byte) 0);
|
||||||
TEMP_LAVA_BLOCKS.put(block, tblock);
|
TEMP_LAVA_BLOCKS.put(block, tblock);
|
||||||
affectedBlocks.add(tblock);
|
affectedBlocks.add(tblock);
|
||||||
|
|
||||||
if (allowNaturalFlow) {
|
if (allowNaturalFlow) {
|
||||||
TempBlock.instances.remove(block);
|
// ProjectKorra.plugin.getLogger().info("Flow free!");
|
||||||
|
TempBlock.removeBlock(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue