mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-16 22:03:53 +00:00
Added range command for brushes. Thanks Nichts
This commit is contained in:
@ -100,6 +100,31 @@ public class TargetBlock {
|
||||
prevPos = targetPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns any block at the sight. Returns null if out of range or if no
|
||||
* viable target was found. Will try to return the last valid air block it finds.
|
||||
*
|
||||
* @return Block
|
||||
*/
|
||||
public BlockWorldVector getAnyTargetBlock() {
|
||||
boolean searchForLastBlock = true;
|
||||
BlockWorldVector lastBlock = null;
|
||||
while (getNextBlock() != null) {
|
||||
if (world.getBlockType(getCurrentBlock()) == 0) {
|
||||
if(searchForLastBlock) {
|
||||
lastBlock = getCurrentBlock();
|
||||
if (lastBlock.getBlockY() <= 0 || lastBlock.getBlockY() >= 127) {
|
||||
searchForLastBlock = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
BlockWorldVector currentBlock = getCurrentBlock();
|
||||
return (currentBlock != null ? currentBlock : lastBlock);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the block at the sight. Returns null if out of range or if no
|
||||
* viable target was found
|
||||
|
Reference in New Issue
Block a user