void Process(Level lvl) { try { if (Count == 0) { return; } if (!lvl.HasPlayers()) { Clear(); return; } bulkSender.level = lvl; int count = Count; if (count > UpdatesPerTick) { count = UpdatesPerTick; } for (int i = 0; i < count; i++) { ulong flags = this[i]; int index = (int)(flags >> posShift); BlockID block = (BlockID)flags; bulkSender.Add(index, block); } bulkSender.Flush(); RemoveRange(0, count); } catch (Exception e) { Logger.LogError(e); Logger.Log(LogType.Warning, "Failed to flush block queue on {0}. {1} lost.", lvl.name, Count); Clear(); } }
static void ProcessLevelBlocks(Level lvl) { try { if (lvl.blockqueue.Count < 1) { return; } bulkSender.level = lvl; int count = blockupdates; if (lvl.blockqueue.Count < blockupdates || !lvl.HasPlayers()) { count = lvl.blockqueue.Count; } for (int i = 0; i < count; i++) { ulong flags = lvl.blockqueue[i]; int index = (int)(flags >> 32); byte block = (flags & 0x100) != 0 ? Block.custom_block : (byte)flags; byte extBlock = (flags & 0x100) != 0 ? (byte)flags : Block.air; bulkSender.Add(index, block, extBlock); } bulkSender.Send(true); lvl.blockqueue.RemoveRange(0, count); } catch (Exception e) { Server.s.ErrorCase("error:" + e); Server.s.Log(String.Format("Block cache failed for map: {0}. {1} lost.", lvl.name, lvl.blockqueue.Count)); lvl.blockqueue.Clear(); } }
static void ProcessLevelBlocks(Level lvl) { try { if (lvl.blockqueue.Count < 1) { return; } bulkSender.level = lvl; int count = blockupdates; if (lvl.blockqueue.Count < blockupdates || !lvl.HasPlayers()) { count = lvl.blockqueue.Count; } for (int c = 0; c < count; c++) { block item = lvl.blockqueue[c]; bulkSender.Add(item.index, item.type, item.extType); bulkSender.CheckIfSend(false); } bulkSender.CheckIfSend(true); lvl.blockqueue.RemoveRange(0, count); } catch (Exception e) { Server.s.ErrorCase("error:" + e); Server.s.Log(String.Format("Block cache failed for map: {0}. {1} lost.", lvl.name, lvl.blockqueue.Count)); lvl.blockqueue.Clear(); } }
static void ProcessLevelBlocks(Level lvl) { try { if (lvl.blockqueue.Count == 0) { return; } if (!lvl.HasPlayers()) { lvl.blockqueue.Clear(); return; } bulkSender.level = lvl; int count = blockupdates; if (lvl.blockqueue.Count < blockupdates) { count = lvl.blockqueue.Count; } for (int i = 0; i < count; i++) { ulong flags = lvl.blockqueue[i]; int index = (int)(flags >> 32); byte block = (flags & 0x100) != 0 ? Block.custom_block : (byte)flags; byte extBlock = (flags & 0x100) != 0 ? (byte)flags : Block.Air; bulkSender.Add(index, block, extBlock); } bulkSender.Send(true); lvl.blockqueue.RemoveRange(0, count); } catch (Exception e) { Logger.LogError(e); Logger.Log(LogType.Warning, "Block cache failed for map: {0}. {1} lost.", lvl.name, lvl.blockqueue.Count); lvl.blockqueue.Clear(); } }