本文整理汇总了C#中MCForge.Entity.Player.SendBlockchangeToOthers方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SendBlockchangeToOthers方法的具体用法?C# Player.SendBlockchangeToOthers怎么用?C# Player.SendBlockchangeToOthers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCForge.Entity.Player
的用法示例。
在下文中一共展示了Player.SendBlockchangeToOthers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BlockChange
/// <summary>
/// Causes a block change for the level
/// </summary>
/// <param name="x">Location of x</param>
/// <param name="z">Location of z</param>
/// <param name="y">Location of y</param>
/// <param name="block">Block to set</param>
/// <param name="p">A player who doesn't need the update.</param>
/// <param name="blockqueue">Should this blockchange be queued by BlockQueue?</param>
public void BlockChange(ushort x, ushort z, ushort y, byte block, Player p = null, bool blockqueue = false)
{
if (blockqueue)
{
BlockQueue.Addblock(p, x, y, z, block);
}
if (!IsInBounds(x, z, y) || y == CWMap.Size.z)
{
Logger.Log("Blockchange((ushort) " + x + ", (ushort)" + z + ", (ushort) " + y + ", (byte) " + block + ", (Player) " + p + ") is outside of level");
return;
}
byte currentType = GetBlock(x, z, y);
if (block == 0)
{
pblocks.ForEach(pb =>
{
if (pb.X == x && pb.Y == y && pb.Z == z)
{
pblocks.Remove(pb);
return;
}
});
}
if (block == currentType) return;
if (p != null)
{
byte blockFrom = GetBlock(x, z, y);
BlockChangeHistory.Add(p.Level.Name, (uint)p.UID, x, z, y, block);
}
SetBlock(x, z, y, block);
if (p == null)
Player.GlobalBlockchange(this, x, z, y, block);
else
{
p.SendBlockchangeToOthers(this, x, z, y, block);
p.SendBlockChange(x, z, y, block);
}
if ((Block)block is PhysicsBlock)
{
PhysicsBlock pb = (PhysicsBlock)((PhysicsBlock)block).Clone();
pb.X = x;
pb.Y = y;
pb.Z = z;
pblocks.Add(pb);
}
//TODO Special stuff for block changing
}
示例2: BlockChange
/// <summary>
/// Causes a block change for the level
/// </summary>
/// <param name="x">Location of x</param>
/// <param name="z">Location of z</param>
/// <param name="y">Location of y</param>
/// <param name="block">Block to set</param>
/// <param name="p">A player who doesn't need the update.</param>
public void BlockChange(ushort x, ushort z, ushort y, byte block, Player p = null)
{
if (y == Size.y) return;
byte currentType = GetBlock(x, z, y);
if (block == currentType) return;
SetBlock(x, z, y, block);
if (p == null)
Player.GlobalBlockchange(this, x, z, y, block);
else p.SendBlockchangeToOthers(this, x, z, y, block);
//TODO Special stuff for block changing
}