本文整理汇总了C#中MCForge.Player.SendBlockChange方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SendBlockChange方法的具体用法?C# Player.SendBlockChange怎么用?C# Player.SendBlockChange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCForge.Player
的用法示例。
在下文中一共展示了Player.SendBlockChange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public void Use(Player p, string[] args)
{
p.isFlying = !p.isFlying;
if (!p.isFlying)
{
return;
}
p.SendMessage("You are now flying. &cJump!");
Thread fly = new Thread(new ThreadStart(delegate
{
Point3 pos;
Point3 oldpos = new Point3();
List<Point3> buffer = new List<Point3>();
while (p.isFlying)
{
Thread.Sleep(20);
if (p.Pos.x == oldpos.x && p.Pos.z == oldpos.z && p.Pos.y == oldpos.y) continue;
try
{
List<Point3> tempBuffer = new List<Point3>();
List<Point3> toRemove = new List<Point3>();
ushort x = (ushort)((p.Pos.x) / 32);
ushort z = (ushort)((p.Pos.z) / 32);
ushort y = (ushort)((p.Pos.y - 60) / 32);
try
{
for (ushort xx = (ushort)(x - 1); xx <= x + 1; xx++)
{
for (ushort yy = (ushort)(y - 1); yy <= y; yy++)
{
for (ushort zz = (ushort)(z - 1); zz <= z + 1; zz++)
{
if (p.level.GetBlock(xx,zz, yy) == (byte)Blocks.Types.air)
{
pos.x = (short)xx; pos.y = (short)yy; pos.z = (short)zz;
tempBuffer.Add(pos);
}
}
}
}
foreach (Point3 cP in tempBuffer)
{
if (!buffer.Contains(cP))
{
buffer.Add(cP);
p.SendBlockChange((ushort)cP.x, (ushort)cP.z, (ushort)cP.y, (byte)Blocks.Types.glass);
}
}
foreach (Point3 cP in buffer)
{
if (!tempBuffer.Contains(cP))
{
p.SendBlockChange((ushort)cP.x, (ushort)cP.z, (ushort)cP.y, (byte)Blocks.Types.air);
toRemove.Add(cP);
}
}
foreach (Point3 cP in toRemove)
{
buffer.Remove(cP);
}
tempBuffer.Clear();
toRemove.Clear();
}
catch { }
}
catch { }
//
//p.Pos.CopyTo(oldpos, 0);
}
foreach (Point3 cP in buffer)
{
p.SendBlockChange((ushort)cP.x, (ushort)cP.z, (ushort)cP.y, (byte)Blocks.Types.air);
}
p.SendMessage("Stopped flying");
}));
fly.Start();
}