crwdns132615:0crwdne132615:0

crwdns132617:0:javadoc:crwdnd132617:0:javadoc:crwdne132617:0

crwdns132619:0:javadoc:crwdnd132619:0:javadoc:crwdnd132619:0:javadoc:crwdnd132619:0:javadoc:crwdne132619:0

Tip

crwdns132621:0crwdne132621:0

crwdns132623:0:javadoc:crwdnd132623:0:javadoc:crwdnd132623:0:javadoc:crwdne132623:0

Note

crwdns132625:0crwdne132625:0

crwdns132627:0crwdne132627:0

crwdns132629:0crwdne132629:0

  • crwdns132631:0crwdne132631:0

  • crwdns132633:0crwdne132633:0

  • crwdns132635:0:javadoc:crwdne132635:0

  • crwdns132637:0crwdne132637:0

  • crwdns132639:0crwdne132639:0

crwdns132641:0crwdne132641:0

crwdns132643:0:javadoc:crwdne132643:0

import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.util.blockray.BlockRay;
import org.spongepowered.api.world.World;

Player player;
BlockRay<World> blockRay = BlockRay.from(player)
    .filter(BlockRay.continueAfterFilter(BlockRay.onlyAirFilter(), 1)).build();

crwdns132645:0crwdne132645:0

crwdns132647:0:javadoc:crwdnd132647:0:javadoc:crwdnd132647:0:javadoc:crwdne132647:0

crwdns132649:0crwdne132649:0

crwdns132651:0crwdne132651:0

import org.spongepowered.api.util.blockray.BlockRayHit;
import java.util.Optional;

BlockRay<World> blockRay;
Optional<BlockRayHit<World>> hitOpt = blockRay.end();
if (hitOpt.isPresent()) {
    BlockRayHit<World> hit = hitOpt.get();
    System.out.println("Found " + hit.getLocation().getBlockType() + " block at "
        + hit.getLocation() + " with intersection at " + hit.getPosition());
}