Skip to content

Instantly share code, notes, and snippets.

private static final boolean seesMoon(LivingEntity e) {
final BlockIterator bi = new BlockIterator(e.getWorld(), e.getEyeLocation().toVector(),
e.getLocation().getDirection(), 0.0, 200);
while (bi.hasNext()) {
final Block block = bi.next();
if (block.getType() != Material.AIR) {
if (block.getType() != Material.BEDROCK || bi.hasNext()) {
return false;
}