crwdns35371:0crwdne35371:0

crwdns35372:0:javadoc:crwdnd35372:0:javadoc:crwdne35372:0

crwdns35373:0:javadoc:crwdnd35373:0:javadoc:crwdnd35373:0:javadoc:crwdnd35373:0:javadoc:crwdne35373:0

Tip

crwdns35374:0crwdne35374:0

crwdns35375:0:javadoc:crwdnd35375:0:javadoc:crwdnd35375:0:javadoc:crwdne35375:0

Note

crwdns35376:0crwdne35376:0

crwdns35377:0crwdne35377:0

crwdns35378:0crwdne35378:0

  • crwdns35379:0crwdne35379:0

  • crwdns35380:0crwdne35380:0

  • crwdns35381:0:javadoc:crwdne35381:0

  • crwdns35382:0crwdne35382:0

  • crwdns35383:0crwdne35383:0

crwdns35384:0crwdne35384:0

crwdns35385:0:javadoc:crwdne35385: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();

crwdns35386:0crwdne35386:0

crwdns35387:0:javadoc:crwdnd35387:0:javadoc:crwdnd35387:0:javadoc:crwdne35387:0

crwdns35388:0crwdne35388:0

crwdns35389:0crwdne35389: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());
}