crwdns151943:0crwdne151943:0

crwdns151945:0:javadoc:crwdnd151945:0:javadoc:crwdne151945:0

crwdns151947:0:javadoc:crwdnd151947:0:javadoc:crwdnd151947:0:javadoc:crwdnd151947:0:javadoc:crwdne151947:0

Tip

crwdns151949:0crwdne151949:0

crwdns151951:0:javadoc:crwdnd151951:0:javadoc:crwdnd151951:0:javadoc:crwdne151951:0

Note

crwdns151953:0crwdne151953:0

crwdns151955:0crwdne151955:0

crwdns151957:0crwdne151957:0

  • crwdns151959:0crwdne151959:0

  • crwdns151961:0crwdne151961:0

  • crwdns151963:0:javadoc:crwdne151963:0

  • crwdns151965:0crwdne151965:0

  • crwdns151967:0crwdne151967:0

crwdns151969:0crwdne151969:0

crwdns151971:0:javadoc:crwdne151971: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();

crwdns151973:0crwdne151973:0

crwdns151975:0:javadoc:crwdnd151975:0:javadoc:crwdnd151975:0:javadoc:crwdne151975:0

crwdns151977:0crwdne151977:0

crwdns151979:0crwdne151979: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());
}