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


C# Player.SendBlockChange方法代码示例

本文整理汇总了C#中Player.SendBlockChange方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SendBlockChange方法的具体用法?C# Player.SendBlockChange怎么用?C# Player.SendBlockChange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player.SendBlockChange方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Blockchange1

        void Blockchange1(Player p, int x, int y, int z, short type)
        {
            p.ClearBlockChange();
            p.SendBlockChange(x, (byte)y, z, p.level.GetBlock(x, y, z), p.level.GetMeta(x, y, z));

            p.SendMessage("Position: " + x + "," + y + "," + z);
            p.SendMessage("Type: " + p.level.GetBlock(x, y, z));
            p.SendMessage("Meta: " + p.level.GetMeta(x, y, z));
            p.SendMessage("Extra: " + p.level.GetExtra(x, y, z));
        }
开发者ID:Defuseninja,项目名称:ForgeCraft,代码行数:10,代码来源:CmdAbout.cs

示例2: Blockchange2

        void Blockchange2(Player p, int x, int y, int z, short type)
        {
            p.ClearBlockChange();
            //p.SendMessage("tile: " + x + " " + y + " " + z + " " + type);
            p.SendBlockChange(x, (byte)y, z, p.level.GetBlock(x, y, z), p.level.GetMeta(x, y, z));
            CuboidData cd = (CuboidData)p.BlockChangeObject;
            byte meta = (byte)p.inventory.current_item.meta;
            if (cd.type != -1) type = cd.type;
            if (!FindBlocks.ValidBlock(type)) type = 0;

            int sx = Math.Min(cd.x, x);
            int ex = Math.Max(cd.x, x);
            int sy = Math.Min(cd.y, y);
            int ey = Math.Max(cd.y, y);
            int sz = Math.Min(cd.z, z);
            int ez = Math.Max(cd.z, z);

            int total = 0;
            p.SendMessage("Cuboiding...");
            switch (cd.mode)
            {
                case CuboidType.Solid:
                    for (int xx = sx; xx <= ex; xx++)
                        for (int yy = sy; yy <= ey; yy++)
                            for (int zz = sz; zz <= ez; zz++)
                            {
                                p.level.BlockChange(xx, yy, zz, (byte)type, meta, false);
                                total++;
                            }
                    break;
                case CuboidType.Hollow:
                    for (int xx = sx; xx <= ex; xx++)
                        for (int zz = sz; zz <= ez; zz++)
                        {
                            p.level.BlockChange(xx, sy, zz, (byte)type, meta, false);
                            p.level.BlockChange(xx, ey, zz, (byte)type, meta, false);
                            total += 2;
                        }
                    for (int yy = sy; yy <= ey; yy++)
                    {
                        for (int xx = sx; xx <= ex; xx++)
                        {
                            p.level.BlockChange(xx, yy, sz, (byte)type, meta, false);
                            p.level.BlockChange(xx, yy, ez, (byte)type, meta, false);
                            total += 2;
                        }
                        for (int zz = sz; zz <= ez; zz++)
                        {
                            p.level.BlockChange(sx, yy, zz, (byte)type, meta, false);
                            p.level.BlockChange(ex, yy, zz, (byte)type, meta, false);
                            total += 2;
                        }
                    }
                    break;
                case CuboidType.Walls:
                    for (int yy = sy; yy <= ey; yy++)
                    {
                        for (int xx = sx; xx <= ex; xx++)
                        {
                            p.level.BlockChange(xx, yy, sz, (byte)type, meta, false);
                            p.level.BlockChange(xx, yy, ez, (byte)type, meta, false);
                            total += 2;
                        }
                        for (int zz = sz; zz <= ez; zz++)
                        {
                            p.level.BlockChange(sx, yy, zz, (byte)type, meta, false);
                            p.level.BlockChange(ex, yy, zz, (byte)type, meta, false);
                            total += 2;
                        }
                    }
                    break;
                case CuboidType.Holes:
                    bool Checked = true, startZ, startY;
                    for (int xx = sx; xx <= ex; xx++)
                    {
                        startY = Checked;
                        for (int yy = sy; yy <= ey; yy++)
                        {
                            startZ = Checked;
                            for (int zz = sz; zz <= ez; zz++)
                            {
                                Checked = !Checked;
                                if (Checked) { p.level.BlockChange(xx, yy, zz, (byte)type, meta, false); total++; }
                            }
                            Checked = !startZ;
                        }
                        Checked = !startY;
                    }
                    break;
                case CuboidType.Wire:
                    for (int xx = sx; xx <= ex; xx++)
                    {
                        p.level.BlockChange(xx, sy, sz, (byte)type, meta, false);
                        p.level.BlockChange(xx, sy, ez, (byte)type, meta, false);
                        p.level.BlockChange(xx, ey, sz, (byte)type, meta, false);
                        p.level.BlockChange(xx, ey, ez, (byte)type, meta, false);
                        total += 4;
                    }
                    for (int yy = sy; yy <= ey; yy++)
                    {
//.........这里部分代码省略.........
开发者ID:TaFinalDestination,项目名称:ForgeCraft,代码行数:101,代码来源:CmdCuboid.cs

示例3: Blockchange1

 void Blockchange1(Player p, int x, int y, int z, short type)
 {
     p.ClearBlockChange();
     //p.SendMessage("tile: " + x + " " + y + " " + z + " " + type);
     p.SendBlockChange(x, (byte)y, z, p.level.GetBlock(x, y, z), p.level.GetMeta(x, y, z));
     CuboidData cd = (CuboidData)p.BlockChangeObject;
     cd.x = x; cd.y = y; cd.z = z;
     p.BlockChangeObject = cd;
     p.OnBlockChange += Blockchange2;
 }
开发者ID:TaFinalDestination,项目名称:ForgeCraft,代码行数:10,代码来源:CmdCuboid.cs

示例4: PlaceSlabs

 public static bool PlaceSlabs(Player a, BCS b)
 {
     if (a.level.GetMeta((int)b.pos.X, (int)b.pos.Y - 1, (int)b.pos.Z) == (byte)a.inventory.current_item.meta && a.level.GetBlock((int)b.pos.X, (int)b.pos.Y - 1, (int)b.pos.Z) == 44)
     {
         a.SendBlockChange(b.pos, 0);
         a.level.BlockChange((int)b.pos.X, (int)b.pos.Y - 1, (int)b.pos.Z, 43, (byte)a.inventory.current_item.meta);
         if (Server.mode == 0) { a.inventory.Remove(a.inventory.current_index, 1); a.experience.Add(1); }
         return false;
     }
     return true;
 }
开发者ID:Nerketur,项目名称:ForgeCraft,代码行数:11,代码来源:BlockChangeSystem.cs

示例5: Update

        public void Update(World w, Player p)
        {
            byte bType, bMeta;
            ushort bExtra;
            int xxx, zzz;
            Container c;
            for (int xx = 0; xx < Width; xx++)
                for (int zz = 0; zz < Depth; zz++)
                    for (int yy = 0; yy < Height; yy++)
                    {
                        xxx = (x << 4) + xx; zzz = (z << 4) + zz;
                        bType = GetBlock(xx, yy, zz);
                        bMeta = GetMetaData(xx, yy, zz);

                        if (bType == (byte)Blocks.SignPost || bType == (byte)Blocks.SignWall)
                            p.SendUpdateSign(xxx, (short)yy, zzz, w.GetSign(xxx, yy, zzz));
                        if (bType == (byte)Blocks.Jukebox)
                        {
                            bExtra = GetExtraData(xx, yy, zz);
                            if (bExtra >= 2256 && bExtra <= 2266)
                                p.SendSoundEffect(xxx, (byte)yy, zzz, 1005, bExtra);
                        }
                        if (bType == (byte)Blocks.Chest)
                        {
                            p.SendBlockChange(xxx, (byte)yy, zzz, bType, bMeta);
                            c = w.GetBlockContainer(xxx, yy, zzz);
                            if (c != null) c.UpdateState();
                        }
                    }
        }
开发者ID:Nerketur,项目名称:ForgeCraft,代码行数:30,代码来源:Chunk.cs

示例6: Blockchange2

        void Blockchange2(Player p, int x, int y, int z, short type)
        {
            p.ClearBlockChange();
            //p.SendMessage("tile: " + x + " " + y + " " + z + " " + type);
            p.SendBlockChange(x, (byte)y, z, p.level.GetBlock(x, y, z), p.level.GetMeta(x, y, z));
            SpheroidData cd = (SpheroidData)p.BlockChangeObject;
            byte meta = (byte)p.inventory.current_item.meta;
            if (cd.type != -1) type = cd.type;
            if (!FindBlocks.ValidBlock(type)) type = 0;

            int sx = Math.Min(cd.x, x);
            int ex = Math.Max(cd.x, x);
            int sy = Math.Min(cd.y, y);
            int ey = Math.Max(cd.y, y);
            int sz = Math.Min(cd.z, z);
            int ez = Math.Max(cd.z, z);

            int total = 0;
            p.SendMessage("Spheroiding...");
            if (!cd.vertical)
            {
                // find center points
                double cx = (ex + sx) / 2 + (((ex + sx) % 2 == 1) ? 0.5 : 0);
                double cy = (ey + sy) / 2 + (((ey + sy) % 2 == 1) ? 0.5 : 0);
                double cz = (ez + sz) / 2 + (((ez + sz) % 2 == 1) ? 0.5 : 0);

                // find axis lengths
                double rx = Convert.ToDouble(ex) - cx + 0.25;
                double ry = Convert.ToDouble(ey) - cy + 0.25;
                double rz = Convert.ToDouble(ez) - cz + 0.25;

                double rx2 = 1 / (rx * rx);
                double ry2 = 1 / (ry * ry);
                double rz2 = 1 / (rz * rz);

                //int totalBlocks = (int)(Math.PI * 0.75 * rx * ry * rz);

                for (int xx = sx; xx <= ex; xx += 8)
                    for (int yy = sy; yy <= ey; yy += 8)
                        for (int zz = sz; zz <= ez; zz += 8)
                            for (int z3 = 0; z3 < 8 && zz + z3 <= ez; z3++)
                                for (int y3 = 0; y3 < 8 && yy + y3 <= ey; y3++)
                                    for (int x3 = 0; x3 < 8 && xx + x3 <= ex; x3++)
                                    {
                                        // get relative coordinates
                                        double dx = (xx + x3 - cx);
                                        double dy = (yy + y3 - cy);
                                        double dz = (zz + z3 - cz);

                                        // test if it's inside ellipse
                                        if ((dx * dx) * rx2 + (dy * dy) * ry2 + (dz * dz) * rz2 <= 1)
                                        {
                                            p.level.BlockChange(x3 + xx, yy + y3, zz + z3, (byte)type, meta, false);
                                            total++;
                                        }
                                    }
            }
            else
            {
                // find center points
                double cx = (ex + sx) / 2 + (((ex + sx) % 2 == 1) ? 0.5 : 0);
                double cz = (ez + sz) / 2 + (((ez + sz) % 2 == 1) ? 0.5 : 0);

                // find axis lengths
                double rx = Convert.ToDouble(ex) - cx + 0.25;
                double rz = Convert.ToDouble(ez) - cz + 0.25;

                double rx2 = 1 / (rx * rx);
                double rz2 = 1 / (rz * rz);
                double smallrx2 = 1 / ((rx - 1) * (rx - 1));
                double smallrz2 = 1 / ((rz - 1) * (rz - 1));

                for (int xx = sx; xx <= ex; xx += 8)
                    for (int zz = sz; zz <= ez; zz += 8)
                        for (int z3 = 0; z3 < 8 && zz + z3 <= ez; z3++)
                            for (int x3 = 0; x3 < 8 && xx + x3 <= ex; x3++)
                            {
                                // get relative coordinates
                                double dx = (xx + x3 - cx);
                                double dz = (zz + z3 - cz);

                                // test if it's inside ellipse
                                if ((dx * dx) * rx2 + (dz * dz) * rz2 <= 1 && (dx * dx) * smallrx2 + (dz * dz) * smallrz2 > 1)
                                {
                                    p.level.BlockChange(x3 + xx, sy, zz + z3, (byte)type, meta, false);
                                    total++;
                                }
                            }
            }
            p.SendMessage(total + " blocks.");
        }
开发者ID:Defuseninja,项目名称:ForgeCraft,代码行数:91,代码来源:CmdSpheroid.cs

示例7: 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();
        }
开发者ID:EricKilla,项目名称:MCForge-Vanilla-1,代码行数:80,代码来源:CmdFly.cs


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