本文整理匯總了Java中org.bukkit.Chunk.getChunkSnapshot方法的典型用法代碼示例。如果您正苦於以下問題:Java Chunk.getChunkSnapshot方法的具體用法?Java Chunk.getChunkSnapshot怎麽用?Java Chunk.getChunkSnapshot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.Chunk
的用法示例。
在下文中一共展示了Chunk.getChunkSnapshot方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkChunk
import org.bukkit.Chunk; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
public void checkChunk(final Chunk chunk)
{
final ChunkSnapshot chunkSnap = chunk.getChunkSnapshot(true, false, false);
for(int x = 0; x < 16; x++)
{
for(int z = 0; z < 16; z++)
{
final int y = chunkSnap.getHighestBlockYAt(x, z);
if(chunkSnap.getBlockTypeId(x, y, z) == Material.SNOW.getId())
placeSnow(chunk, chunkSnap, x, y, z);
}
}
}
示例2: onBlockChange
import org.bukkit.Chunk; //導入方法依賴的package包/類
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onBlockChange(BlockTransformEvent event) {
Chunk chunk = event.getOldState().getChunk();
ChunkVector chunkVector = ChunkVector.of(chunk);
if(!chunkSnapshots.containsKey(chunkVector)) {
logger.fine("Copying chunk at " + chunkVector);
ChunkSnapshot chunkSnapshot = chunk.getChunkSnapshot();
chunkSnapshot.updateBlock(event.getOldState()); // ChunkSnapshot is very likely to have the post-event state already, so we have to correct it
chunkSnapshots.put(chunkVector, chunkSnapshot);
}
}