Examples of ReadyChunkInfo


Examples of org.terasology.world.chunks.internal.ReadyChunkInfo

                        chunk = chunkStore.getChunk();
                    }

                    InternalLightProcessor.generateInternalLighting(chunk);
                    chunk.deflate();
                    readyChunks.offer(new ReadyChunkInfo(chunk, createBatchBlockEventMappings(chunk), chunkStore));
                }
            });
        }
    }
View Full Code Here

Examples of org.terasology.world.chunks.internal.ReadyChunkInfo

    }


    @Override
    public void onChunkIsReady(Chunk chunk) {
        readyChunks.offer(new ReadyChunkInfo(chunk, createBatchBlockEventMappings(chunk)));
    }
View Full Code Here

Examples of org.terasology.world.chunks.internal.ReadyChunkInfo

        }
    }

    @Override
    public void completeUpdate() {
        ReadyChunkInfo readyChunkInfo = lightMerger.completeMerge();
        if (readyChunkInfo != null) {
            Chunk chunk = readyChunkInfo.getChunk();
            chunk.lock();
            try {
                chunk.markReady();
                if (!readyChunkInfo.isNewChunk()) {
                    PerformanceMonitor.startActivity("Generating Block Entities");
                    generateBlockEntities(chunk);
                    PerformanceMonitor.endActivity();
                }
                if (readyChunkInfo.getChunkStore() != null) {
                    readyChunkInfo.getChunkStore().restoreEntities();
                }

                if (!readyChunkInfo.isNewChunk()) {
                    PerformanceMonitor.startActivity("Sending OnAddedBlocks");
                    readyChunkInfo.getBlockPositionMapppings().forEachEntry(new TShortObjectProcedure<TIntList>() {
                        @Override
                        public boolean execute(short id, TIntList positions) {
                            if (positions.size() > 0) {
                                blockManager.getBlock(id).getEntity().send(new OnAddedBlocks(positions, registry));
                            }
                            return true;
                        }
                    });
                    PerformanceMonitor.endActivity();
                }

                PerformanceMonitor.startActivity("Sending OnActivateBlocks");
                readyChunkInfo.getBlockPositionMapppings().forEachEntry(new TShortObjectProcedure<TIntList>() {
                    @Override
                    public boolean execute(short id, TIntList positions) {
                        if (positions.size() > 0) {
                            blockManager.getBlock(id).getEntity().send(new OnActivatedBlocks(positions, registry));
                        }
                        return true;
                    }
                });
                PerformanceMonitor.endActivity();

                if (!readyChunkInfo.isNewChunk()) {
                    worldEntity.send(new OnChunkGenerated(readyChunkInfo.getPos()));
                }
                worldEntity.send(new OnChunkLoaded(readyChunkInfo.getPos()));
                for (ChunkRelevanceRegion region : regions.values()) {
                    region.chunkReady(chunk);
                }
            } finally {
                chunk.unlock();
View Full Code Here

Examples of org.terasology.world.chunks.internal.ReadyChunkInfo

            Collections.sort(sortedReadyChunks, new ReadyChunkRelevanceComparator());
        }
        if (!sortedReadyChunks.isEmpty()) {
            boolean loaded = false;
            for (int i = sortedReadyChunks.size() - 1; i >= 0 && !loaded; i--) {
                ReadyChunkInfo chunkInfo = sortedReadyChunks.get(i);
                PerformanceMonitor.startActivity("Make Chunk Available");
                if (makeChunkAvailable(chunkInfo)) {
                    sortedReadyChunks.remove(i);
                    loaded = true;
                }
View Full Code Here

Examples of org.terasology.world.chunks.internal.ReadyChunkInfo

                    if (!chunk.isReady()) {
                        // Chunk hasn't been finished or changed, so just drop it.
                        iterator.remove();
                        Iterator<ReadyChunkInfo> infoIterator = sortedReadyChunks.iterator();
                        while (infoIterator.hasNext()) {
                            ReadyChunkInfo next = infoIterator.next();
                            if (next.getPos().equals(chunk.getPosition())) {
                                infoIterator.remove();
                                break;
                            }
                        }
                        continue;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.