本文整理汇总了Java中cn.nukkit.level.format.generic.BaseFullChunk.isPopulated方法的典型用法代码示例。如果您正苦于以下问题:Java BaseFullChunk.isPopulated方法的具体用法?Java BaseFullChunk.isPopulated怎么用?Java BaseFullChunk.isPopulated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cn.nukkit.level.format.generic.BaseFullChunk
的用法示例。
在下文中一共展示了BaseFullChunk.isPopulated方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateChunkCallback
import cn.nukkit.level.format.generic.BaseFullChunk; //导入方法依赖的package包/类
public void generateChunkCallback(int x, int z, BaseFullChunk chunk) {
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 || !oldChunk.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();
}
示例2: populateChunk
import cn.nukkit.level.format.generic.BaseFullChunk; //导入方法依赖的package包/类
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, true);
for (int xx = -1; xx <= 1; ++xx) {
for (int zz = -1; zz <= 1; ++zz) {
this.chunkPopulationLock.put(Level.chunkHash(x + xx, z + zz), true);
}
}
PopulationTask task = new PopulationTask(this, chunk);
this.server.getScheduler().scheduleAsyncTask(task);
}
}
Timings.populationTimer.stopTiming();
return false;
}
return true;
}
示例3: loadChunk
import cn.nukkit.level.format.generic.BaseFullChunk; //导入方法依赖的package包/类
public boolean loadChunk(int x, int z, boolean generate) {
Long index = Level.chunkHash(x, z);
if (this.chunks.containsKey(index)) {
return true;
}
this.timings.syncChunkLoadTimer.startTiming();
this.cancelUnloadChunkRequest(x, z);
BaseFullChunk chunk = this.provider.getChunk(x, z, generate);
if (chunk == null) {
if (generate) {
throw new IllegalStateException("Could not create new Chunk");
}
return false;
}
this.chunks.put(index, chunk);
chunk.initChunk();
if (chunk.getProvider() != null) {
this.server.getPluginManager().callEvent(new ChunkLoadEvent(chunk, !chunk.isGenerated()));
} else {
this.unloadChunk(x, z, false);
this.timings.syncChunkLoadTimer.stopTiming();
return false;
}
if (!chunk.isLightPopulated() && chunk.isPopulated()
&& (boolean) this.getServer().getConfig("chunk-ticking.light-updates", false)) {
this.getServer().getScheduler().scheduleAsyncTask(new LightPopulationTask(this, chunk));
}
if (this.isChunkInUse(x, z)) {
for (ChunkLoader loader : this.getChunkLoaders(x, z)) {
loader.onChunkLoaded(chunk);
}
} else {
this.unloadChunkRequest(x, z);
}
this.timings.syncChunkLoadTimer.stopTiming();
return true;
}