Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save theresajayne/d4481ab6d387fcb0c8c5fa1d6d1365fb to your computer and use it in GitHub Desktop.
Save theresajayne/d4481ab6d387fcb0c8c5fa1d6d1365fb to your computer and use it in GitHub Desktop.
public static Block getTargetBlock(Player player, int range) {
Location loc = player.getEyeLocation();
Vector dir = loc.getDirection().normalize();
Block b = null;
for (int i = 0; i <= range; i++) {
b = loc.add(dir).getBlock();
}
return b;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment