Example #1
0
        public void UpdateBlock(Player p, ushort x, ushort y, ushort z,
                                byte block, byte extBlock, ushort flags)
        {
            byte old = GetTile(x, y, z), oldExt = 0;

            if (old == Block.custom_block)
            {
                oldExt = GetExtTile(x, y, z);
            }

            bool drawn = (flags & BlockDBFlags.ManualPlace) != 0;

            if (!DoBlockchange(p, x, y, z, block, extBlock, drawn))
            {
                return;
            }
            BlockDB.Add(p, x, y, z, flags,
                        old, oldExt, block, extBlock);

            int index = PosToInt(x, y, z);

            if (bufferblocks)
            {
                BlockQueue.Addblock(p, index, block, extBlock);
            }
            else
            {
                Player.GlobalBlockchange(this, x, y, z, block, extBlock);
            }
        }
Example #2
0
        public void UpdateBlock(Player p, ushort x, ushort y, ushort z, ExtBlock block,
                                ushort flags = BlockDBFlags.ManualPlace, bool buffered = false)
        {
            ExtBlock old   = GetBlock(x, y, z);
            bool     drawn = (flags & BlockDBFlags.ManualPlace) != 0;
            int      type  = DoBlockchange(p, x, y, z, block, drawn);

            if (type == 0)
            {
                return;            // no block change performed
            }
            BlockDB.Cache.Add(p, x, y, z, flags, old, block);
            if (type == 1)
            {
                return;            // not different visually
            }
            int index = PosToInt(x, y, z);

            if (buffered)
            {
                BlockQueue.Addblock(p, index, block);
            }
            else
            {
                Player.GlobalBlockchange(this, x, y, z, block);
            }
        }
Example #3
0
        public void UpdateBlock(Player p, ushort x, ushort y, ushort z, byte type, byte extType)
        {
            if (!DoBlockchange(p, x, y, z, type, extType))
            {
                return;
            }
            BlockPos bP = default(BlockPos);

            bP.name  = p.name;
            bP.index = PosToInt(x, y, z);
            bP.SetData(type, extType, type == 0);
            blockCache.Add(bP);

            if (bufferblocks)
            {
                BlockQueue.Addblock(p, bP.index, type, extType);
            }
            else
            {
                Player.GlobalBlockchange(this, x, y, z, type, extType);
            }
        }