Search in sources :

Example 1 with IDungeonPart

use of team.cqr.cqrepoured.world.structure.generation.generation.part.IDungeonPart in project ChocolateQuestRepoured by TeamChocoQuest.

the class GeneratableDungeon method tryGeneratePart.

private void tryGeneratePart(World world) {
    long t = System.nanoTime();
    for (IDungeonPart part : this.parts) {
        part.generate(world, this);
    }
    for (ChunkInfo chunkInfo : this.chunkInfoMap.values()) {
        Chunk chunk = world.getChunk(chunkInfo.getChunkX(), chunkInfo.getChunkZ());
        if (world.provider.hasSkyLight()) {
            for (int chunkY = chunkInfo.topMarked(); chunkY >= 0; chunkY--) {
                ChunkSection blockStorage = chunk.getSections()[chunkY];
                if (blockStorage == Chunk.EMPTY_SECTION) {
                    blockStorage = new ChunkSection(chunkY << 4);
                    chunk.getSections()[chunkY] = blockStorage;
                }
                Arrays.fill(blockStorage.getSkyLight().getData(), (byte) 0);
            }
        }
        chunkInfo.forEach(chunkY -> {
            ChunkSection blockStorage = chunk.getSections()[chunkY];
            if (blockStorage != Chunk.EMPTY_SECTION) {
                Arrays.fill(blockStorage.getBlockLight().getData(), (byte) 0);
            }
            int r = 1;
            for (int x = -r; x <= r; x++) {
                for (int y = -r; y <= r; y++) {
                    for (int z = -r; z <= r; z++) {
                        this.chunkInfoMapExtended.mark(chunkInfo.getChunkX() + x, chunkY + y, chunkInfo.getChunkZ() + z);
                    }
                }
            }
        });
    }
    this.generationTimes[1] += System.nanoTime() - t;
}
Also used : IDungeonPart(team.cqr.cqrepoured.world.structure.generation.generation.part.IDungeonPart) Chunk(net.minecraft.world.chunk.Chunk) ChunkSection(net.minecraft.world.chunk.ChunkSection)

Aggregations

Chunk (net.minecraft.world.chunk.Chunk)1 ChunkSection (net.minecraft.world.chunk.ChunkSection)1 IDungeonPart (team.cqr.cqrepoured.world.structure.generation.generation.part.IDungeonPart)1