cn.nukkit.level.format.generic.BaseFullChunk Java Examples

The following examples show how to use cn.nukkit.level.format.generic.BaseFullChunk. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PopulatorGlowStone.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    this.level = level;
    BaseFullChunk chunk = level.getChunk(chunkX, chunkZ);
    int bx = chunkX << 4;
    int bz = chunkZ << 4;
    int tx = bx + 15;
    int tz = bz + 15;
    ObjectOre ore = new ObjectOre(random, type, Block.AIR);
    for (int i = 0; i < ore.type.clusterCount; ++i) {
        int x = random.nextRange(0, 15);
        int z = random.nextRange(0, 15);
        int y = this.getHighestWorkableBlock(chunk, x, z);
        if (y != -1) {
            ore.placeObject(level, bx + x, y, bz + z);
        }
    }
}
 
Example #2
Source File: Level.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public Block getBlock(int x, int y, int z) {
    int fullState;
    if (y >= 0 && y < 256) {
        int cx = x >> 4;
        int cz = z >> 4;
        BaseFullChunk chunk = getChunk(cx, cz);
        if (chunk != null) {
            fullState = chunk.getFullBlock(x & 0xF, y, z & 0xF);
        } else {
            fullState = 0;
        }
    } else {
        fullState = 0;
    }
    Block block = this.blockStates[fullState & 0xFFF].clone();
    block.x = x;
    block.y = y;
    block.z = z;
    block.level = this;
    return block;
}
 
Example #3
Source File: PopulatorGroundFire.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    this.level = level;
    BaseFullChunk chunk = level.getChunk(chunkX, chunkZ);
    int bx = chunkX << 4;
    int bz = chunkZ << 4;
    int tx = bx + 15;
    int tz = bz + 15;
    int amount = random.nextRange(0, this.randomAmount + 1) + this.baseAmount;
    for (int i = 0; i < amount; ++i) {
        int x = random.nextRange(0, 15);
        int z = random.nextRange(0, 15);
        int y = this.getHighestWorkableBlock(chunk, x, z);
        if (y != -1 && this.canGroundFireStay(chunk, x, y, z)) {
            chunk.setBlock(x, y, z, Block.FIRE);
            chunk.setBlockLight(x, y, z, Block.light[Block.FIRE]);
        }
    }
}
 
Example #4
Source File: Level.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
public void close() {
    if (this.getAutoSave()) {
        this.save();
    }

    for (BaseFullChunk chunk : new ArrayList<>(this.chunks.values())) {
        this.unloadChunk(chunk.getX(), chunk.getZ(), false);
    }

    this.unregisterGenerator();

    this.provider.close();
    this.provider = null;
    this.blockMetadata = null;
    this.blockCache.clear();
    this.temporalPosition = null;
    this.server.getLevels().remove(this.levelId);
}
 
Example #5
Source File: PopulatorGlowStone.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void populate(ChunkManager level, int chunkX, int chunkZ, NukkitRandom random) {
    this.level = level;
    BaseFullChunk chunk = level.getChunk(chunkX, chunkZ);
    int bx = chunkX << 4;
    int bz = chunkZ << 4;
    int tx = bx + 15;
    int tz = bz + 15;
    ObjectOre ore = new ObjectOre(random, type, Block.AIR);
    for (int i = 0; i < ore.type.clusterCount; ++i) {
        int x = random.nextRange(0, 15);
        int z = random.nextRange(0, 15);
        int y = this.getHighestWorkableBlock(chunk, x, z);
        if (y != -1) {
            ore.placeObject(level, bx + x, y, bz + z);
        }
    }
}
 
Example #6
Source File: Level.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
private void processChunkRequest() {
    this.timings.syncChunkSendTimer.startTiming();
    for (long index : this.chunkSendQueue.keySet()) {
        if (this.chunkSendTasks.contains(index)) {
            continue;
        }
        int x = getHashX(index);
        int z = getHashZ(index);
        this.chunkSendTasks.add(index);
        BaseFullChunk chunk = getChunk(x, z);
        if (chunk != null) {
            BatchPacket packet = chunk.getChunkPacket();
            if (packet != null) {
                this.sendChunk(x, z, index, packet);
                continue;
            }
        }
        this.timings.syncChunkSendPrepareTimer.startTiming();
        AsyncTask task = this.provider.requestChunkTask(x, z);
        if (task != null) {
            this.server.getScheduler().scheduleAsyncTask(task);
        }
        this.timings.syncChunkSendPrepareTimer.stopTiming();
    }
    this.timings.syncChunkSendTimer.stopTiming();
}
 
Example #7
Source File: Anvil.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void doGarbageCollection(long time) {
    long start = System.currentTimeMillis();
    int maxIterations = size();
    if (lastPosition > maxIterations) lastPosition = 0;
    int i;
    synchronized (chunks) {
        ObjectIterator<BaseFullChunk> iter = chunks.values().iterator();
        if (lastPosition != 0) iter.skip(lastPosition);
        for (i = 0; i < maxIterations; i++) {
            if (!iter.hasNext()) {
                iter = chunks.values().iterator();
            }
            if (!iter.hasNext()) break;
            BaseFullChunk chunk = iter.next();
            if (chunk == null) continue;
            if (chunk.isGenerated() && chunk.isPopulated() && chunk instanceof Chunk) {
                Chunk anvilChunk = (Chunk) chunk;
                chunk.compress();
                if (System.currentTimeMillis() - start >= time) break;
            }
        }
    }
    lastPosition += i;
}
 
Example #8
Source File: McRegion.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
@Override
public BaseFullChunk loadChunk(long index, int chunkX, int chunkZ, boolean create) {
    int regionX = getRegionIndexX(chunkX);
    int regionZ = getRegionIndexZ(chunkZ);
    BaseRegionLoader region = this.loadRegion(regionX, regionZ);
    this.level.timings.syncChunkLoadDataTimer.startTiming();
    BaseFullChunk chunk;
    try {
        chunk = region.readChunk(chunkX - regionX * 32, chunkZ - regionZ * 32);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    if (chunk == null) {
        if (create) {
            chunk = this.getEmptyChunk(chunkX, chunkZ);
            putChunk(index, chunk);
        }
    } else {
        putChunk(index, chunk);
    }
    this.level.timings.syncChunkLoadDataTimer.stopTiming();
    return chunk;
}
 
Example #9
Source File: Anvil.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
@Override
public synchronized BaseFullChunk loadChunk(long index, int chunkX, int chunkZ, boolean create) {
    int regionX = getRegionIndexX(chunkX);
    int regionZ = getRegionIndexZ(chunkZ);
    BaseRegionLoader region = this.loadRegion(regionX, regionZ);
    this.level.timings.syncChunkLoadDataTimer.startTiming();
    BaseFullChunk chunk;
    try {
        chunk = region.readChunk(chunkX - regionX * 32, chunkZ - regionZ * 32);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    if (chunk == null) {
        if (create) {
            chunk = this.getEmptyChunk(chunkX, chunkZ);
            putChunk(index, chunk);
        }
    } else {
        putChunk(index, chunk);
    }
    this.level.timings.syncChunkLoadDataTimer.stopTiming();
    return chunk;
}
 
Example #10
Source File: Anvil.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
@Override
public BaseFullChunk loadChunk(long index, int chunkX, int chunkZ, boolean create) {
    int regionX = getRegionIndexX(chunkX);
    int regionZ = getRegionIndexZ(chunkZ);
    BaseRegionLoader region = this.loadRegion(regionX, regionZ);
    this.level.timings.syncChunkLoadDataTimer.startTiming();
    BaseFullChunk chunk;
    try {
        chunk = region.readChunk(chunkX - regionX * 32, chunkZ - regionZ * 32);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    if (chunk == null) {
        if (create) {
            chunk = this.getEmptyChunk(chunkX, chunkZ);
            putChunk(index, chunk);
        }
    } else {
        putChunk(index, chunk);
    }
    this.level.timings.syncChunkLoadDataTimer.stopTiming();
    return chunk;
}
 
Example #11
Source File: Level.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
private void processChunkRequest() {
    this.timings.syncChunkSendTimer.startTiming();
    for (Long index : ImmutableList.copyOf(this.chunkSendQueue.keySet())) {
        if (this.chunkSendTasks.containsKey(index)) {
            continue;
        }
        int x = getHashX(index);
        int z = getHashZ(index);
        this.chunkSendTasks.put(index, Boolean.TRUE);
        BaseFullChunk chunk = getChunk(x, z);
        if (chunk != null) {
            BatchPacket packet = chunk.getChunkPacket();
            if (packet != null) {
                this.sendChunk(x, z, index, packet);
                continue;
            }
        }
        this.timings.syncChunkSendPrepareTimer.startTiming();
        AsyncTask task = this.provider.requestChunkTask(x, z);
        if (task != null) {
            this.server.getScheduler().scheduleAsyncTask(task);
        }
        this.timings.syncChunkSendPrepareTimer.stopTiming();
    }
    this.timings.syncChunkSendTimer.stopTiming();
}
 
Example #12
Source File: Level.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public synchronized Block getBlock(int x, int y, int z, boolean load) {
    int fullState;
    if (y >= 0 && y < 256) {
        int cx = x >> 4;
        int cz = z >> 4;
        BaseFullChunk chunk;
        if (load) {
            chunk = getChunk(cx, cz);
        } else {
            chunk = getChunkIfLoaded(cx, cz);
        }
        if (chunk != null) {
            fullState = chunk.getFullBlock(x & 0xF, y, z & 0xF);
        } else {
            fullState = 0;
        }
    } else {
        fullState = 0;
    }
    Block block = Block.fullList[fullState & 0xFFF].clone();
    block.x = x;
    block.y = y;
    block.z = z;
    block.level = this;
    return block;
}
 
Example #13
Source File: PopulationTask.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCompletion(Server server) {
    if (level != null) {
        if (!this.state) {
            return;
        }

        BaseFullChunk centerChunk = this.centerChunk;

        if (centerChunk == null) {
            return;
        }

        for (BaseFullChunk chunk : this.chunks) {
            if (chunk != null) {
                level.generateChunkCallback(chunk.getX(), chunk.getZ(), chunk);
            }
        }

        level.generateChunkCallback(centerChunk.getX(), centerChunk.getZ(), centerChunk, isPopulated);
    }
}
 
Example #14
Source File: Level.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public boolean populateChunk(int x, int z, boolean force) {
    long index = Level.chunkHash(x, z);
    if (this.chunkPopulationQueue.containsKey(index) || this.chunkPopulationQueue.size() >= this.chunkPopulationQueueSize && !force) {
        return false;
    }

    BaseFullChunk chunk = this.getChunk(x, z, true);
    boolean populate;
    if (!chunk.isPopulated()) {
        Timings.populationTimer.startTiming();
        populate = true;
        for (int xx = -1; xx <= 1; ++xx) {
            for (int zz = -1; zz <= 1; ++zz) {
                if (this.chunkPopulationLock.containsKey(Level.chunkHash(x + xx, z + zz))) {

                    populate = false;
                    break;
                }
            }
        }

        if (populate) {
            if (!this.chunkPopulationQueue.containsKey(index)) {
                this.chunkPopulationQueue.put(index, Boolean.TRUE);
                for (int xx = -1; xx <= 1; ++xx) {
                    for (int zz = -1; zz <= 1; ++zz) {
                        this.chunkPopulationLock.put(Level.chunkHash(x + xx, z + zz), Boolean.TRUE);
                    }
                }

                PopulationTask task = new PopulationTask(this, chunk);
                this.server.getScheduler().scheduleAsyncTask(task);
            }
        }
        Timings.populationTimer.stopTiming();
        return false;
    }

    return true;
}
 
Example #15
Source File: GenerationTask.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRun() {
    Generator generator = GeneratorPool.get(this.levelId);

    if (generator == null) {
        this.state = false;
        return;
    }

    SimpleChunkManager manager = (SimpleChunkManager) generator.getChunkManager();

    if (manager == null) {
        this.state = false;
        return;
    }

    synchronized (manager) {
        BaseFullChunk chunk = this.chunk.clone();

        if (chunk == null) {
            return;
        }

        manager.setChunk(chunk.getX(), chunk.getZ(), chunk);

        generator.generateChunk(chunk.getX(), chunk.getZ());

        chunk = manager.getChunk(chunk.getX(), chunk.getZ());
        chunk.setGenerated();
        this.chunk = chunk.clone();

        manager.setChunk(chunk.getX(), chunk.getZ(), null);
    }

}
 
Example #16
Source File: NukkitQueue.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setHeightMap(FaweChunk chunk, byte[] heightMap) {
    BaseFullChunk forgeChunk = (BaseFullChunk) chunk.getChunk();
    if (forgeChunk != null) {
        byte[] otherMap = forgeChunk.getHeightMapArray();
        for (int i = 0; i < heightMap.length; i++) {
            int newHeight = heightMap[i] & 0xFF;
            int currentHeight = otherMap[i] & 0xFF;
            if (newHeight > currentHeight) {
                otherMap[i] = (byte) newHeight;
            }
        }
    }
}
 
Example #17
Source File: Anvil.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public synchronized void saveChunk(int X, int Z) {
    BaseFullChunk chunk = this.getChunk(X, Z);
    if (chunk != null) {
        try {
            this.loadRegion(X >> 5, Z >> 5).writeChunk(chunk);
        } catch (Exception e) {
            throw new ChunkException("Error saving chunk (" + X + ", " + Z + ")", e);
        }
    }
}
 
Example #18
Source File: Level.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
private synchronized BaseFullChunk forceLoadChunk(long index, int x, int z, boolean generate) {
    this.timings.syncChunkLoadTimer.startTiming();
    BaseFullChunk chunk = this.provider.getChunk(x, z, generate);
    if (chunk == null) {
        if (generate) {
            throw new IllegalStateException("Could not create new Chunk");
        }
        this.timings.syncChunkLoadTimer.stopTiming();
        return chunk;
    }

    if (chunk.getProvider() != null) {
        this.server.getPluginManager().callEvent(new ChunkLoadEvent(chunk, !chunk.isGenerated()));
    } else {
        this.unloadChunk(x, z, false);
        this.timings.syncChunkLoadTimer.stopTiming();
        return chunk;
    }

    chunk.initChunk();

    if (!chunk.isLightPopulated() && chunk.isPopulated()
            && this.getServer().getConfig("chunk-ticking.light-updates", false)) {
        this.getServer().getScheduler().scheduleAsyncTask(new LightPopulationTask(this, chunk));
    }

    if (this.isChunkInUse(index)) {
        this.unloadQueue.remove(index);
        for (ChunkLoader loader : this.getChunkLoaders(x, z)) {
            loader.onChunkLoaded(chunk);
        }
    } else {
        this.unloadQueue.put(index, System.currentTimeMillis());
    }
    this.timings.syncChunkLoadTimer.stopTiming();
    return chunk;
}
 
Example #19
Source File: Level.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public void chunkRequestCallback(long timestamp, int x, int z, int subChunkCount, byte[] payload) {
    this.timings.syncChunkSendTimer.startTiming();
    long index = Level.chunkHash(x, z);

    if (this.cacheChunks) {
        BatchPacket data = Player.getChunkCacheFromData(x, z, subChunkCount, payload);
        BaseFullChunk chunk = getChunk(x, z, false);
        if (chunk != null && chunk.getChanges() <= timestamp) {
            chunk.setChunkPacket(data);
        }
        this.sendChunk(x, z, index, data);
        this.timings.syncChunkSendTimer.stopTiming();
        return;
    }

    if (this.chunkSendTasks.contains(index)) {
        for (Player player : this.chunkSendQueue.get(index).values()) {
            if (player.isConnected() && player.usedChunks.containsKey(index)) {
                player.sendChunk(x, z, subChunkCount, payload);
            }
        }

        this.chunkSendQueue.remove(index);
        this.chunkSendTasks.remove(index);
    }
    this.timings.syncChunkSendTimer.stopTiming();
}
 
Example #20
Source File: Anvil.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void doGarbageCollection(long time) {
    long start = System.currentTimeMillis();
    int maxIterations = size();
    if (lastPosition > maxIterations) lastPosition = 0;
    ObjectIterator<BaseFullChunk> iter = getChunks();
    if (lastPosition != 0) iter.skip(lastPosition);
    int i;
    for (i = 0; i < maxIterations; i++) {
        if (!iter.hasNext()) {
            iter = getChunks();
        }
        BaseFullChunk chunk = iter.next();
        if (chunk == null) continue;
        if (chunk.isGenerated() && chunk.isPopulated() && chunk instanceof Chunk) {
            Chunk anvilChunk = (Chunk) chunk;
            for (cn.nukkit.level.format.ChunkSection section : anvilChunk.getSections()) {
                if (section instanceof ChunkSection) {
                    ChunkSection anvilSection = (ChunkSection) section;
                    if (!anvilSection.isEmpty()) {
                        anvilSection.compress();
                    }
                }
            }
            if (System.currentTimeMillis() - start >= time) break;
        }
    }
    lastPosition += i;
}
 
Example #21
Source File: NukkitQueue.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int getCombinedId4Data(BaseFullChunk chunkSection, int x, int y, int z) {
    int id = chunkSection.getBlockId(x & 15, y, z & 15);
    if (FaweCache.hasData(id)) {
        int data = chunkSection.getBlockData(x & 15, y, z & 15);
        return (id << 4) + data;
    } else {
        return (id << 4);
    }
}
 
Example #22
Source File: PopulationTask.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCompletion(Server server) {
    Level level = server.getLevel(this.levelId);
    if (level != null) {
        if (!this.state) {
            level.registerGenerator();
            return;
        }

        BaseFullChunk chunk = this.chunk.clone();

        if (chunk == null) {
            return;
        }

        for (int i = 0; i < 9; i++) {
            if (i == 4) {
                continue;
            }

            BaseFullChunk c = this.chunks[i];
            if (c != null) {
                c = c.clone();
                level.generateChunkCallback(c.getX(), c.getZ(), c);
            }
        }

        level.generateChunkCallback(chunk.getX(), chunk.getZ(), chunk);
    }
}
 
Example #23
Source File: Level.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public void generateChunkCallback(int x, int z, BaseFullChunk chunk, boolean isPopulated) {
    Timings.generationCallbackTimer.startTiming();
    long index = Level.chunkHash(x, z);
    if (this.chunkPopulationQueue.containsKey(index)) {
        FullChunk oldChunk = this.getChunk(x, z, false);
        for (int xx = -1; xx <= 1; ++xx) {
            for (int zz = -1; zz <= 1; ++zz) {
                this.chunkPopulationLock.remove(Level.chunkHash(x + xx, z + zz));
            }
        }
        this.chunkPopulationQueue.remove(index);
        chunk.setProvider(this.provider);
        this.setChunk(x, z, chunk, false);
        chunk = this.getChunk(x, z, false);
        if (chunk != null && (oldChunk == null || !isPopulated) && chunk.isPopulated()
                && chunk.getProvider() != null) {
            this.server.getPluginManager().callEvent(new ChunkPopulateEvent(chunk));

            for (ChunkLoader loader : this.getChunkLoaders(x, z)) {
                loader.onChunkPopulated(chunk);
            }
        }
    } else if (this.chunkGenerationQueue.containsKey(index) || this.chunkPopulationLock.containsKey(index)) {
        this.chunkGenerationQueue.remove(index);
        this.chunkPopulationLock.remove(index);
        chunk.setProvider(this.provider);
        this.setChunk(x, z, chunk, false);
    } else {
        chunk.setProvider(this.provider);
        this.setChunk(x, z, chunk, false);
    }
    Timings.generationCallbackTimer.stopTiming();
}
 
Example #24
Source File: NukkitQueue.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean removeSectionLighting(BaseFullChunk section, int layer, boolean hasSky) {
    int minY = layer << 4;
    int maxY = minY + 15;
    for (int y = minY; y < maxY; y++) {
        for (int z = 0; z < 16; z++) {
            for (int x = 0; x < 16; x++) {
                section.setBlockSkyLight(x, y, z, 0);
                section.setBlockLight(x, y, z, 0);
            }
        }
    }
    return true;
}
 
Example #25
Source File: LightPopulationTask.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCompletion(Server server) {
    Level level = server.getLevel(this.levelId);

    BaseFullChunk chunk = this.chunk.clone();
    if (level != null) {
        if (chunk == null) {
            return;
        }

        level.generateChunkCallback(chunk.getX(), chunk.getZ(), chunk);
    }
}
 
Example #26
Source File: LightPopulationTask.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRun() {
    BaseFullChunk chunk = this.chunk.clone();
    if (chunk == null) {
        return;
    }

    chunk.recalculateHeightMap();
    chunk.populateSkyLight();
    chunk.setLightPopulated();

    this.chunk = chunk.clone();
}
 
Example #27
Source File: PopChunkManager.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setChunk(int chunkX, int chunkZ, BaseFullChunk chunk) {
    if (CX == Integer.MAX_VALUE) {
        CX = chunkX;
        CZ = chunkZ;
    }
    int index;
    switch (chunkX - CX) {
        case 0:
            index = 0;
            break;
        case 1:
            index = 1;
            break;
        case 2:
            index = 2;
            break;
        default:
            throw new UnsupportedOperationException("Chunk is outside population area");
    }
    switch (chunkZ - CZ) {
        case 0:
            break;
        case 1:
            index += 3;
            break;
        case 2:
            index += 6;
            break;
        default:
            throw new UnsupportedOperationException("Chunk is outside population area");
    }
    clean = false;
    chunks[index] = chunk;
}
 
Example #28
Source File: PopChunkManager.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public BaseFullChunk getChunk(int chunkX, int chunkZ) {
    int index;
    switch (chunkX - CX) {
        case 0:
            index = 0;
            break;
        case 1:
            index = 1;
            break;
        case 2:
            index = 2;
            break;
        default:
            return null;
    }
    switch (chunkZ - CZ) {
        case 0:
            break;
        case 1:
            index += 3;
            break;
        case 2:
            index += 6;
            break;
        default:
            return null;
    }
    return chunks[index];
}
 
Example #29
Source File: Flat.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void populateChunk(int chunkX, int chunkZ) {
    BaseFullChunk chunk = level.getChunk(chunkX, chunkZ);
    this.random.setSeed(0xdeadbeef ^ (chunkX << 8) ^ chunkZ ^ this.level.getSeed());
    for (Populator populator : this.populators) {
        populator.populate(this.level, chunkX, chunkZ, this.random, chunk);
    }
}
 
Example #30
Source File: NukkitQueue.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setFullbright(BaseFullChunk sections) {
    for (int y = 0; y < 256; y++) {
        for (int z = 0; z < 16; z++) {
            for (int x = 0; x < 16; x++) {
                sections.setBlockSkyLight(x, y, z, 15);
            }
        }
    }
}