mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-21 15:44:35 +00:00
Update LavaFlow to new sourcing system
This commit is contained in:
parent
59033dab88
commit
a26e091a52
4 changed files with 11 additions and 9 deletions
|
@ -168,7 +168,7 @@ public class LavaFlow {
|
|||
}
|
||||
instances.add(this);
|
||||
} else if (type == AbilityType.CLICK) {
|
||||
Block sourceBlock = BlockSource.getEarthOrLavaSourceBlock(player, clickRange, clickRange, ClickType.SHIFT_DOWN, false, dynamic, true, EarthMethods.canSandbend(player));
|
||||
Block sourceBlock = BlockSource.getEarthOrLavaSourceBlock(player, clickRange, clickRange, ClickType.CLICK, false, dynamic, true, EarthMethods.canSandbend(player), EarthMethods.canMetalbend(player));
|
||||
if (sourceBlock == null) {
|
||||
remove();
|
||||
return;
|
||||
|
@ -372,7 +372,6 @@ public class LavaFlow {
|
|||
*
|
||||
* @param testBlock the block to attempt to remove
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void removeLava(Block testBlock) {
|
||||
for (int i = 0; i < TEMP_LAVA_BLOCKS.size(); i++) {
|
||||
TempBlock tblock = TEMP_LAVA_BLOCKS.get(i);
|
||||
|
@ -384,8 +383,8 @@ public class LavaFlow {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
TempBlock tblock = new TempBlock(testBlock, REVERT_MATERIAL, testBlock.getData());
|
||||
|
||||
TempBlock tblock = new TempBlock(testBlock, REVERT_MATERIAL, (byte) 0);
|
||||
affectedBlocks.add(tblock);
|
||||
TEMP_LAND_BLOCKS.add(tblock);
|
||||
}
|
||||
|
@ -526,7 +525,10 @@ public class LavaFlow {
|
|||
public static boolean isEarthbendableMaterial(Material mat, Player player) {
|
||||
for (String s : ProjectKorra.plugin.getConfig().getStringList("Properties.Earth.EarthbendableBlocks"))
|
||||
if (mat == Material.getMaterial(s))
|
||||
return true;
|
||||
return true;
|
||||
if (ProjectKorra.plugin.getConfig().getStringList("Properties.Earth.SandBlocks").contains(mat.toString()) && EarthMethods.canSandbend(player)) {
|
||||
return true;
|
||||
}
|
||||
if (ProjectKorra.plugin.getConfig().getStringList("Properties.Earth.MetalBlocks").contains(mat.toString()) && EarthMethods.canMetalbend(player)) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class LavaWall {
|
|||
|
||||
public boolean prepare() {
|
||||
cancelPrevious();
|
||||
Block block = BlockSource.getEarthOrLavaSourceBlock(player, selectRange, selectRange, ClickType.LEFT_CLICK, false, dynamic, true, EarthMethods.canSandbend(player));
|
||||
Block block = BlockSource.getEarthOrLavaSourceBlock(player, selectRange, selectRange, ClickType.LEFT_CLICK, false, dynamic, true, EarthMethods.canSandbend(player), EarthMethods.canMetalbend(player));
|
||||
if (block != null) {
|
||||
sourceblock = block;
|
||||
focusBlock();
|
||||
|
|
|
@ -67,7 +67,7 @@ public class LavaWave {
|
|||
public boolean prepare() {
|
||||
cancelPrevious();
|
||||
// Block block = player.getTargetBlock(null, (int) range);
|
||||
Block block = BlockSource.getEarthOrLavaSourceBlock(player, selectRange, selectRange, ClickType.SHIFT_DOWN, false, dynamic, true, EarthMethods.canSandbend(player));
|
||||
Block block = BlockSource.getEarthOrLavaSourceBlock(player, selectRange, selectRange, ClickType.SHIFT_DOWN, false, dynamic, true, EarthMethods.canSandbend(player), EarthMethods.canMetalbend(player));
|
||||
if (block != null) {
|
||||
sourceblock = block;
|
||||
focusBlock();
|
||||
|
|
|
@ -278,13 +278,13 @@ public class BlockSource {
|
|||
* either {@link ClickType}.SHIFT_DOWN or ClickType.LEFT_CLICK.
|
||||
* @return a valid Earth or Lava bendable block, or null if none was found.
|
||||
*/
|
||||
public static Block getEarthOrLavaSourceBlock(Player player, int autoRange, int selectRange, ClickType clickType, boolean auto, boolean dynamic, boolean earth, boolean sand) {
|
||||
public static Block getEarthOrLavaSourceBlock(Player player, int autoRange, int selectRange, ClickType clickType, boolean auto, boolean dynamic, boolean earth, boolean sand, boolean metal) {
|
||||
/*
|
||||
* When Lava is selected as a source it automatically overrides the
|
||||
* previous Earth based source. Only one of these types can exist, so if
|
||||
* Lava exists then we know Earth is null.
|
||||
*/
|
||||
Block earthBlock = getEarthSourceBlock(player, autoRange, selectRange, clickType, auto, dynamic, earth, sand, false);
|
||||
Block earthBlock = getEarthSourceBlock(player, autoRange, selectRange, clickType, auto, dynamic, earth, sand, metal);
|
||||
BlockSourceInformation lavaBlockInfo = getValidBlockSourceInformation(player, selectRange, BlockSourceType.LAVA, clickType);
|
||||
if (earthBlock != null) {
|
||||
return earthBlock;
|
||||
|
|
Loading…
Reference in a new issue