crwdns19933:0crwdne19933:0

crwdns19934:0:javadoc:crwdnd19934:0:javadoc:crwdne19934:0

crwdns19935:0:javadoc:crwdnd19935:0:javadoc:crwdnd19935:0:javadoc:crwdnd19935:0:javadoc:crwdne19935:0

Tip

crwdns19936:0crwdne19936:0

crwdns41585:0:javadoc:crwdnd41585:0:javadoc:crwdnd41585:0:javadoc:crwdne41585:0

Note

crwdns41586:0crwdne41586:0

crwdns19939:0crwdne19939:0

crwdns41587:0crwdne41587:0

  • crwdns19941:0crwdne19941:0
  • crwdns19942:0crwdne19942:0
  • crwdns19943:0:javadoc:crwdne19943:0
  • crwdns19945:0crwdne19945:0

crwdns19946:0crwdne19946:0

crwdns19947:0:javadoc:crwdne19947: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)
    .stopFilter(BlockRay.continueAfterFilter(BlockRay.onlyAirFilter(), 1)).build();

crwdns41588:0crwdne41588:0

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

crwdns19948:0crwdne19948:0

crwdns19949:0:javadoc:crwdnd19949:0:javadoc:crwdnd19949:0:javadoc:crwdne19949:0

crwdns19950:0crwdne19950:0

crwdns19951:0crwdne19951: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());
}