当前位置: 首页>>代码示例>>C#>>正文


C# Player.SendBlockchangeToOthers方法代码示例

本文整理汇总了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
        }
开发者ID:headdetect,项目名称:MCForge6-Vanilla,代码行数:59,代码来源:Level.cs

示例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
        }
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:22,代码来源:Level.cs


注:本文中的MCForge.Entity.Player.SendBlockchangeToOthers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。