Java Code Examples for cn.nukkit.level.format.FullChunk#setPosition()
The following examples show how to use
cn.nukkit.level.format.FullChunk#setPosition() .
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: LevelDB.java From Nukkit with GNU General Public License v3.0 | 6 votes |
@Override public void setChunk(int chunkX, int chunkZ, FullChunk chunk) { if (!(chunk instanceof Chunk)) { throw new ChunkException("Invalid Chunk class"); } chunk.setProvider(this); chunk.setPosition(chunkX, chunkZ); long index = Level.chunkHash(chunkX, chunkZ); if (this.chunks.containsKey(index) && !this.chunks.get(index).equals(chunk)) { this.unloadChunk(chunkX, chunkZ, false); } this.chunks.put(index, (Chunk) chunk); }
Example 2
Source File: LevelDB.java From Nukkit with GNU General Public License v3.0 | 6 votes |
@Override public void setChunk(int chunkX, int chunkZ, FullChunk chunk) { if (!(chunk instanceof Chunk)) { throw new ChunkException("Invalid Chunk class"); } chunk.setProvider(this); chunk.setPosition(chunkX, chunkZ); long index = Level.chunkHash(chunkX, chunkZ); if (this.chunks.containsKey(index) && !this.chunks.get(index).equals(chunk)) { this.unloadChunk(chunkX, chunkZ, false); } this.chunks.put(index, (Chunk) chunk); }
Example 3
Source File: BaseLevelProvider.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public void setChunk(int chunkX, int chunkZ, FullChunk chunk) { if (!(chunk instanceof BaseFullChunk)) { throw new ChunkException("Invalid Chunk class"); } chunk.setProvider(this); chunk.setPosition(chunkX, chunkZ); long index = Level.chunkHash(chunkX, chunkZ); synchronized (chunks) { if (this.chunks.containsKey(index) && !this.chunks.get(index).equals(chunk)) { this.unloadChunk(chunkX, chunkZ, false); } this.chunks.put(index, (BaseFullChunk) chunk); } }
Example 4
Source File: McRegion.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public void saveChunk(int x, int z, FullChunk chunk) { if (!(chunk instanceof Chunk)) { throw new ChunkException("Invalid Chunk class"); } this.loadRegion(x >> 5, z >> 5); chunk.setPosition(x, z); try { this.getRegion(x >> 5, z >> 5).writeChunk(chunk); } catch (Exception e) { throw new RuntimeException(e); } }
Example 5
Source File: BaseLevelProvider.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public void setChunk(int chunkX, int chunkZ, FullChunk chunk) { if (!(chunk instanceof BaseFullChunk)) { throw new ChunkException("Invalid Chunk class"); } chunk.setProvider(this); chunk.setPosition(chunkX, chunkZ); long index = Level.chunkHash(chunkX, chunkZ); if (this.chunks.containsKey(index) && !this.chunks.get(index).equals(chunk)) { this.unloadChunk(chunkX, chunkZ, false); } this.chunks.put(index, (BaseFullChunk) chunk); }
Example 6
Source File: McRegion.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public void saveChunk(int x, int z, FullChunk chunk) { if (!(chunk instanceof Chunk)) { throw new ChunkException("Invalid Chunk class"); } this.loadRegion(x >> 5, z >> 5); chunk.setPosition(x, z); try { this.getRegion(x >> 5, z >> 5).writeChunk(chunk); } catch (Exception e) { throw new RuntimeException(e); } }