use of cn.nukkit.utils.BlockUpdateEntry in project Nukkit by Nukkit.
the class BlockUpdateScheduler method perform.
private void perform(long tick) {
try {
lastTick = tick;
Set<BlockUpdateEntry> updates = pendingUpdates = queuedUpdates.remove(tick);
if (updates != null) {
for (BlockUpdateEntry entry : updates) {
Vector3 pos = entry.pos;
if (level.isChunkLoaded(NukkitMath.floorDouble(pos.x) >> 4, NukkitMath.floorDouble(pos.z) >> 4)) {
Block block = level.getBlock(entry.pos);
if (Block.equals(block, entry.block, false)) {
block.onUpdate(level.BLOCK_UPDATE_SCHEDULED);
}
} else {
level.scheduleUpdate(entry.block, entry.pos, 0);
}
}
}
} finally {
pendingUpdates = null;
}
}
Aggregations