crwdns122349:0crwdne122349:0

crwdns122351:0:javadoc:crwdnd122351:0:javadoc:crwdne122351:0

crwdns122353:0:javadoc:crwdnd122353:0:javadoc:crwdnd122353:0:javadoc:crwdnd122353:0:javadoc:crwdne122353:0

Tip

crwdns122355:0crwdne122355:0

crwdns122357:0:javadoc:crwdnd122357:0:javadoc:crwdnd122357:0:javadoc:crwdne122357:0

Note

crwdns122359:0crwdne122359:0

crwdns122361:0crwdne122361:0

crwdns122363:0crwdne122363:0

  • crwdns122365:0crwdne122365:0

  • crwdns122367:0crwdne122367:0

  • crwdns122369:0:javadoc:crwdne122369:0

  • crwdns122371:0crwdne122371:0

crwdns122373:0crwdne122373:0

crwdns122375:0:javadoc:crwdne122375: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)
    .skipFilter(BlockRay.onlyAirFilter()).stopFilter(BlockRay.onlyAirFilter()).build();

crwdns122377:0crwdne122377:0

BlockRay<World> blockRay = BlockRay.from(player)
    .skipFilter(BlockRay.onlyAirFilter()).stopFilter(BlockRay.allFilter()).build();

crwdns122379:0crwdne122379:0

crwdns122381:0:javadoc:crwdnd122381:0:javadoc:crwdnd122381:0:javadoc:crwdne122381:0

crwdns122383:0crwdne122383:0

crwdns122385:0crwdne122385: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());
}