コード例 #1
0
 // Generates all non-temporary block entities
 private void generateBlockEntities(Chunk chunk) {
   ChunkBlockIterator i = chunk.getBlockIterator();
   while (i.next()) {
     if (i.getBlock().isKeepActive()) {
       registry.getBlockEntityAt(i.getBlockPos());
     }
   }
 }
コード例 #2
0
  private TShortObjectMap<TIntList> createBatchBlockEventMappings(Chunk chunk) {
    TShortObjectMap<TIntList> batchBlockMap = new TShortObjectHashMap<>();
    for (Block block : blockManager.listRegisteredBlocks()) {
      if (block.isLifecycleEventsRequired()) {
        batchBlockMap.put(block.getId(), new TIntArrayList());
      }
    }

    ChunkBlockIterator i = chunk.getBlockIterator();
    while (i.next()) {
      if (i.getBlock().isLifecycleEventsRequired()) {
        TIntList positionList = batchBlockMap.get(i.getBlock().getId());
        positionList.add(i.getBlockPos().x);
        positionList.add(i.getBlockPos().y);
        positionList.add(i.getBlockPos().z);
      }
    }
    return batchBlockMap;
  }