@Override public ChunkBlockIterator getBlockIterator() { return new ChunkBlockIteratorImpl(blockManager, getChunkWorldOffset(), blockData); }
@Override public int getChunkWorldOffsetY() { return chunkPos.y * getChunkSizeY(); }
@Override public int chunkToWorldPositionY(int y) { return y + getChunkWorldOffsetY(); }
private void updateRelevanceRegionsWithNewChunks(List<ReadyChunkInfo> newReadyChunks) { for (ReadyChunkInfo readyChunkInfo : newReadyChunks) { for (ChunkRelevanceRegion region : regions.values()) { region.checkIfChunkIsRelevant(readyChunkInfo.getChunk()); } } }
public void setRelevanceDistance(Vector3i distance) { if (!distance.equals(this.relevanceDistance)) { reviewRelevantChunks(distance); this.relevanceDistance.set(distance); this.currentRegion = calculateRegion(); dirty = true; } }
@Override public Vector3i next() { Vector3i result = nextChunkPos; calculateNext(); return result; }
@Override public EntityData.ChunkStore.Builder encode() { return ChunkSerializer.encode(chunkPos, blockData, biomeData, extraData); }
public static ReadyChunkInfo createForNewChunk(Chunk chunk, TShortObjectMap<TIntList> blockPositionMapppings, List<EntityStore> entities) { return new ReadyChunkInfo(chunk, blockPositionMapppings, entities); }
@Override public ChunkViewCore getLocalView(Vector3i chunkPos) { return chunkProvider.getLocalView(chunkPos); }
@Override public int getChunkWorldOffsetX() { return chunkPos.x * getChunkSizeX(); }
@Override public int getChunkWorldOffsetZ() { return chunkPos.z * getChunkSizeZ(); }
@Override public ChunkViewCore getWorldViewAround(Vector3i chunk) { return chunkProvider.getSubviewAroundChunk(chunk); }
@Override public int chunkToWorldPositionX(int x) { return x + getChunkWorldOffsetX(); }
@Override public int chunkToWorldPositionZ(int z) { return z + getChunkWorldOffsetZ(); }
@Override public void dispose() { chunkProvider.dispose(); }
@Override public Collection<Region3i> getRelevantRegions() { Collection<Chunk> chunks = chunkProvider.getAllChunks(); Function<Chunk, Region3i> mapping = CoreChunk::getRegion; Predicate<Chunk> isReady = ManagedChunk::isReady; return FluentIterable.from(chunks).filter(isReady).transform(mapping).toList(); } }
@Override public boolean setSunlightRegen(BaseVector3i pos, byte amount) { return setSunlightRegen(pos.x(), pos.y(), pos.z(), amount); }
NeededChunksIterator() { calculateNext(); }
/** * This method can only be * called once after {@link #createSnapshot()} has been called. It can be called from a different thread than * {@link #createSnapshot()}, but it must be made sure that neither method is still running when the other gets * called. * * @return an encoded version of the snapshot taken with {@link #createSnapshot()}. */ public EntityData.ChunkStore.Builder encodeAndReleaseSnapshot() { EntityData.ChunkStore.Builder result = ChunkSerializer.encode(chunkPos, blockDataSnapshot, biomeDataSnapshot, extraDataSnapshots); this.blockDataSnapshot = null; this.biomeDataSnapshot = null; this.extraDataSnapshots = null; return result; }
public static ReadyChunkInfo createForRestoredChunk(Chunk chunk, TShortObjectMap<TIntList> blockPositionMapppings, ChunkStore chunkStore, List<EntityStore> entities) { return new ReadyChunkInfo(chunk, blockPositionMapppings, chunkStore, entities); }