本文整理了Java中org.bukkit.Chunk.getChunkSnapshot()
方法的一些代码示例,展示了Chunk.getChunkSnapshot()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Chunk.getChunkSnapshot()
方法的具体详情如下:
包路径:org.bukkit.Chunk
类名称:Chunk
方法名:getChunkSnapshot
[英]Capture thread-safe read-only snapshot of chunk data
[中]捕获区块数据的线程安全只读快照
代码示例来源:origin: webbukkit/dynmap
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
public void onChunkPopulate(ChunkPopulateEvent event) {
Chunk c = event.getChunk();
ChunkSnapshot cs = c.getChunkSnapshot();
int ymax = 0;
for(int i = 0; i < c.getWorld().getMaxHeight() / 16; i++) {
if(!cs.isSectionEmpty(i)) {
ymax = (i+1)*16;
}
}
/* Touch extreme corners */
int x = c.getX() << 4;
int z = c.getZ() << 4;
mapManager.touchVolume(getWorld(event.getWorld()).getName(), x, 0, z, x+15, ymax, z+16, "chunkpopulate");
}
};
代码示例来源:origin: webbukkit/dynmap
ss = c.getChunkSnapshot(highesty, biome, biomeraw);
代码示例来源:origin: CitizensDev/CitizensAPI
@Override
protected ChunkSnapshot getChunkObject(int x, int z) {
return world.getChunkAt(x, z).getChunkSnapshot(false, false, false);
}
代码示例来源:origin: BentoBoxWorld/BentoBox
chunkSnapshot.add(location.getWorld().getChunkAt(pair.x, pair.z).getChunkSnapshot());
it.remove();
代码示例来源:origin: nsporillo/GlobalWarming
/**
* Update the queue with loaded-chunks one the queue is empty
*/
private void startQueueLoader() {
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(
GlobalWarming.getInstance(),
() -> {
synchronized (this) {
if (requestQueue.isEmpty()) {
for (World world : Bukkit.getWorlds()) {
final WorldClimateEngine worldClimateEngine =
ClimateEngine.getInstance().getClimateEngine(world.getUID());
if (worldClimateEngine != null &&
worldClimateEngine.isEffectEnabled(ClimateEffectType.SEA_LEVEL_RISE) &&
world.getPlayers().size() > 0) {
for (Chunk chunk : world.getLoadedChunks()) {
requestQueue.add(chunk.getChunkSnapshot());
}
}
}
}
}
}, 0L, queueTicks);
}
代码示例来源:origin: BigScary/GriefPrevention
void autoExtendClaim(Claim newClaim)
{
//auto-extend it downward to cover anything already built underground
Location lesserCorner = newClaim.getLesserBoundaryCorner();
Location greaterCorner = newClaim.getGreaterBoundaryCorner();
World world = lesserCorner.getWorld();
ArrayList<ChunkSnapshot> snapshots = new ArrayList<ChunkSnapshot>();
for(int chunkx = lesserCorner.getBlockX() / 16; chunkx <= greaterCorner.getBlockX() / 16; chunkx++)
{
for(int chunkz = lesserCorner.getBlockZ() / 16; chunkz <= greaterCorner.getBlockZ() / 16; chunkz++)
{
if(world.isChunkLoaded(chunkx, chunkz))
{
snapshots.add(world.getChunkAt(chunkx, chunkz).getChunkSnapshot(true, true, true));
}
}
}
Bukkit.getScheduler().runTaskAsynchronously(GriefPrevention.instance, new AutoExtendClaimTask(newClaim, snapshots, world.getEnvironment()));
}
内容来源于网络,如有侵权,请联系作者删除!