本文整理汇总了C#中SMP.World.FlushBlockChanges方法的典型用法代码示例。如果您正苦于以下问题:C# World.FlushBlockChanges方法的具体用法?C# World.FlushBlockChanges怎么用?C# World.FlushBlockChanges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMP.World
的用法示例。
在下文中一共展示了World.FlushBlockChanges方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadLVL
//.........这里部分代码省略.........
Parallel.For(0, chunkcount, i =>
{
try
{
int block = (int)i * 32776;
int x = BitConverter.ToInt32(bytes, 0 + block);
int z = BitConverter.ToInt32(bytes, 4 + block);
Chunk c = new Chunk(x, z);
Array.Copy(bytes, 8 + block, c.blocks, 0, 32768);
c.RecalculateLight();
c.SpreadLight();
lock (w.chunkData)
if (!w.chunkData.ContainsKey(new Point(x, z)))
w.chunkData.Add(new Point(x, z), c);
}
catch (Exception ex)
{
Server.Log(ex.ToString());
}
});
}
else{
for (int i = 0; i < chunkcount; i++)
{
try
{
int block = (int)i * 32776;
int x = BitConverter.ToInt32(bytes, 0 + block);
int z = BitConverter.ToInt32(bytes, 4 + block);
Chunk c = new Chunk(x, z);
Array.Copy(bytes, 8 + block, c.blocks, 0, 32768);
c.RecalculateLight();
c.SpreadLight();
lock (w.chunkData)
if (!w.chunkData.ContainsKey(new Point(x, z)))
w.chunkData.Add(new Point(x, z), c);
}
catch (Exception ex)
{
Server.Log(ex.ToString());
}
}
}
}*/
using (StreamReader sw = new StreamReader(filename + "/" + filename + ".ini"))
{
w.seed = long.Parse(sw.ReadLine());
w.SpawnX = int.Parse(sw.ReadLine());
w.SpawnY = int.Parse(sw.ReadLine());
w.SpawnZ = int.Parse(sw.ReadLine());
w.ChunkLimit = int.Parse(sw.ReadLine());
w.time = long.Parse(sw.ReadLine());
}
w.generator = new GenStandard(w, true);
w.physics = new Physics(w);
try
{
Parallel.For(-3, 4, x =>
{
Parallel.For(-3, 4, z =>
{
w.LoadChunk(x, z, false);
});
});
}
catch (NotImplementedException)
{
for (int x = -3; x < 4; x++)
{
for (int z = -3; z < 4; z++)
{
w.LoadChunk(x, z, false);
}
}
}
World.worlds.Add(w);
Server.Log(filename + " Loaded.");
Server.Log("Look distance = 3");
w.timeupdate.Elapsed += delegate
{
w.time += 20;
if (w.time > 24000)
w.time = 0;
Player.players.ForEach(delegate(Player p) { if (p.MapLoaded && p.level == w) p.SendTime(); });
};
w.timeupdate.Start();
w.blockflush.Elapsed += delegate { w.FlushBlockChanges(); };
w.blockflush.Start();
w.physics.Start();
if (World.WorldLoad != null)
World.WorldLoad(w);
return w;
}