Example #1
0
        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();
                            }
                        }
                    }
                }
            }
        }
Example #2
0
        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();
                        }
                    }
        }