Hello,
I’ve take a look on google for few hours and didnt find a solution to get the relative block using Direction, equivalent to “block.getRelative(BlockFace.EAST)”.
I found this example on this page: org.spongepowered.api.util.Direction Java Exaples
Example 6
Project: Lift File: SpongeElevatorManager.java View source code Vote up 6 votespublic static void scanBaseBlocks(BlockLoc block, SpongeElevator elevator){
if (elevator.baseBlocks.size() >= SpongeLift.maxLiftArea || elevator.baseBlocks.contains(block))
return;
elevator.baseBlocks.add(block);
if (block.getRelative(Direction.NORTH).getType() == elevator.baseBlockType)
scanBaseBlocks(block.getRelative(Direction.NORTH), elevator);
if (block.getRelative(Direction.EAST).getType() == elevator.baseBlockType)
scanBaseBlocks(block.getRelative(Direction.EAST), elevator);
if (block.getRelative(Direction.SOUTH).getType() == elevator.baseBlockType)
scanBaseBlocks(block.getRelative(Direction.SOUTH), elevator);
if (block.getRelative(Direction.WEST).getType() == elevator.baseBlockType)
scanBaseBlocks(block.getRelative(Direction.WEST), elevator);
return;
}
But seem to API dont have the BlockLoc type. How to get the block relative to another based on Direction?
Thanks.