Advertisement
PaleoCrafter

Untitled

Jun 17th, 2015
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.51 KB | None | 0 0
  1. def selectTileEntities(box: AxisAlignedBB)(predicate: TileEntity => Boolean) = {
  2.   val cube = BlockCuboid(box).toChunkSpace
  3.  
  4.   import scala.collection.JavaConverters._
  5.  
  6.   for {
  7.     p <- cube
  8.     if world.getChunkProvider.chunkExists(p.x, p.z)
  9.     chunk = world.getChunkFromChunkCoords(p.x, p.z)
  10.     if !chunk.isEmpty
  11.     tile <- chunk.getTileEntityMap.values.asScala.asInstanceOf[Iterable[TileEntity]]
  12.     if box.minY <= tile.getPos.getY && box.maxY >= tile.getPos.getY && predicate(tile)
  13.   } yield tile
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement