use of hellfirepvp.astralsorcery.common.block.tile.BlockChalice in project AstralSorcery by HellFirePvP.
the class ChaliceHelper method findNearbyChalices.
@Nonnull
public static List<BlockPos> findNearbyChalices(World world, BlockPos origin, int distance) {
Vector3 thisVector = new Vector3(origin).add(0.5, 1.5, 0.5);
List<BlockPos> foundChalices = BlockDiscoverer.searchForBlocksAround(world, origin, MathHelper.clamp(distance, 0, 16), (w, pos, state) -> !pos.equals(origin) && state.getBlock() instanceof BlockChalice && !w.isBlockPowered(pos) && !(w.getBlockState(pos.down()).getBlock() instanceof BlockFountain));
foundChalices.removeIf(pos -> {
Vector3 chaliceVector = new Vector3(pos).add(0.5, 1.5, 0.5);
RaytraceAssist assist = new RaytraceAssist(thisVector, chaliceVector);
return !assist.isClear(world);
});
return foundChalices;
}
Aggregations