Java Code Examples for cn.nukkit.level.Level#getId()

The following examples show how to use cn.nukkit.level.Level#getId() . 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: ChunkRequestTask.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
public ChunkRequestTask(Level level, Chunk chunk) {
    this.levelId = level.getId();
    this.chunk = chunk.toFastBinary();
    this.chunkX = chunk.getX();
    this.chunkZ = chunk.getZ();

    byte[] buffer = new byte[0];

    for (BlockEntity blockEntity : chunk.getBlockEntities().values()) {
        if (blockEntity instanceof BlockEntitySpawnable) {
            try {
                buffer = Binary.appendBytes(buffer, NBTIO.write(((BlockEntitySpawnable) blockEntity).getSpawnCompound(), ByteOrder.BIG_ENDIAN, true));
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

        }
    }

    this.blockEntities = buffer;
}
 
Example 2
Source File: ChunkRequestTask.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public ChunkRequestTask(Level level, Chunk chunk) {
    this.timeStamp = chunk.getChanges();
    this.levelId = level.getId();
    this.chunk = chunk.toFastBinary();
    this.chunkX = chunk.getX();
    this.chunkZ = chunk.getZ();

    byte[] buffer = new byte[0];

    for (BlockEntity blockEntity : chunk.getBlockEntities().values()) {
        if (blockEntity instanceof BlockEntitySpawnable) {
            try {
                buffer = Binary.appendBytes(buffer, NBTIO.write(((BlockEntitySpawnable) blockEntity).getSpawnCompound(), ByteOrder.BIG_ENDIAN, true));
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

        }
    }

    this.blockEntities = buffer;
}
 
Example 3
Source File: PopulationTask.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
public PopulationTask(Level level, BaseFullChunk chunk) {
    this.state = true;
    this.levelId = level.getId();
    this.chunk = chunk;

    for (int i = 0; i < 9; i++) {
        if (i == 4) {
            continue;
        }
        int xx = -1 + i % 3;
        int zz = -1 + (i / 3);
        BaseFullChunk ck = level.getChunk(chunk.getX() + xx, chunk.getZ() + zz, false);
        this.chunks[i] = ck;
    }
}
 
Example 4
Source File: PopulationTask.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public PopulationTask(Level level, BaseFullChunk chunk) {
    this.state = true;
    this.levelId = level.getId();
    this.chunk = chunk;

    int i = 0;
    for (int z = -1; z <= 1; z++) {
        for (int x = -1; x <= 1; x++, i++) {
            if (i == 4) continue;
            BaseFullChunk ck = level.getChunk(chunk.getX() + x, chunk.getZ() + z, false);
            this.chunks[i] = ck;
        }
    }
}
 
Example 5
Source File: LightPopulationTask.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public LightPopulationTask(Level level, BaseFullChunk chunk) {
    this.levelId = level.getId();
    this.chunk = chunk;
}
 
Example 6
Source File: GeneratorRegisterTask.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public GeneratorRegisterTask(Level level, Generator generator) {
    this.generator = generator.getClass();
    this.settings = generator.getSettings();
    this.seed = level.getSeed();
    this.levelId = level.getId();
}
 
Example 7
Source File: GeneratorUnregisterTask.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public GeneratorUnregisterTask(Level level) {
    this.levelId = level.getId();
}
 
Example 8
Source File: GenerationTask.java    From Jupiter with GNU General Public License v3.0 4 votes vote down vote up
public GenerationTask(Level level, BaseFullChunk chunk) {
    this.state = true;
    this.levelId = level.getId();
    this.chunk = chunk;
}
 
Example 9
Source File: LightPopulationTask.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public LightPopulationTask(Level level, BaseFullChunk chunk) {
    this.levelId = level.getId();
    this.chunk = chunk;
}
 
Example 10
Source File: LightPopulationTask.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public LightPopulationTask(Level level, BaseFullChunk chunk) {
    this.levelId = level.getId();
    this.chunk = chunk;
}
 
Example 11
Source File: GeneratorRegisterTask.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public GeneratorRegisterTask(Level level, Generator generator) {
    this.generator = generator.getClass();
    this.settings = generator.getSettings();
    this.seed = level.getSeed();
    this.levelId = level.getId();
}
 
Example 12
Source File: GeneratorUnregisterTask.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public GeneratorUnregisterTask(Level level) {
    this.levelId = level.getId();
}
 
Example 13
Source File: GenerationTask.java    From Nukkit with GNU General Public License v3.0 4 votes vote down vote up
public GenerationTask(Level level, BaseFullChunk chunk) {
    this.state = true;
    this.levelId = level.getId();
    this.chunk = chunk;
}