Beispiel #1
0
        public void CreateTileTick(int x, int y, int z)
        {
            TileTick te = new TileTick()
            {
                ID = _blocks[x, y, z],
            };

            BlockKey key = (TranslateCoordinates != null)
                ? TranslateCoordinates(x, y, z)
                : new BlockKey(x, y, z);

            TagNodeCompound oldte;

            if (_tileTickTable.TryGetValue(key, out oldte)) {
                _tileTicks.Remove(oldte);
            }

            te.X = key.x;
            te.Y = key.y;
            te.Z = key.z;

            TagNodeCompound tree = te.BuildTree() as TagNodeCompound;

            _tileTicks.Add(tree);
            _tileTickTable[key] = tree;
        }
        public void SetTileTickValue (int x, int y, int z, int tickValue)
        {
            BlockKey key = (TranslateCoordinates != null)
                ? TranslateCoordinates(x, y, z)
                : new BlockKey(x, y, z);

            TagNodeCompound te;

            if (!_tileTickTable.TryGetValue(key, out te)) {
                TileTick tt = new TileTick()
                {
                    ID = _blocks[x, y, z],
                    Ticks = tickValue,
                    X = key.x,
                    Y = key.y,
                    Z = key.z,
                };
                te = tt.BuildTree() as TagNodeCompound;

                _tileTicks.Add(te);
                _tileTickTable[key] = te;
            }
            else {
                te["t"].ToTagInt().Data = tickValue;
            }
        }
Beispiel #3
0
        public void SetTileTickValue(int x, int y, int z, int tickValue)
        {
            BlockKey key = (TranslateCoordinates != null)
                ? TranslateCoordinates(x, y, z)
                : new BlockKey(x, y, z);

            TagNodeCompound te;

            if (!_tileTickTable.TryGetValue(key, out te))
            {
                TileTick tt = new TileTick()
                {
                    ID    = _blocks[x, y, z],
                    Ticks = tickValue,
                    X     = key.x,
                    Y     = key.y,
                    Z     = key.z,
                };
                te = tt.BuildTree() as TagNodeCompound;

                _tileTicks.Add(te);
                _tileTickTable[key] = te;
            }
            else
            {
                te["t"].ToTagInt().Data = tickValue;
            }
        }
Beispiel #4
0
        public void CreateTileTick(int x, int y, int z)
        {
            TileTick te = new TileTick()
            {
                ID = _blocks[x, y, z],
            };

            BlockKey key = (TranslateCoordinates != null)
                ? TranslateCoordinates(x, y, z)
                : new BlockKey(x, y, z);

            TagNodeCompound oldte;

            if (_tileTickTable.TryGetValue(key, out oldte))
            {
                _tileTicks.Remove(oldte);
            }

            te.X = key.x;
            te.Y = key.y;
            te.Z = key.z;

            TagNodeCompound tree = te.BuildTree() as TagNodeCompound;

            _tileTicks.Add(tree);
            _tileTickTable[key] = tree;
        }
Beispiel #5
0
        public void SetTileTick(int x, int y, int z, TileTick te)
        {
            if (te.ID != _blocks[x, y, z])
            {
                throw new ArgumentException("The TileTick type is not valid for this block.", "te");
            }

            BlockKey key = (TranslateCoordinates != null)
                ? TranslateCoordinates(x, y, z)
                : new BlockKey(x, y, z);

            TagNodeCompound oldte;

            if (_tileTickTable.TryGetValue(key, out oldte))
            {
                _tileTicks.Remove(oldte);
            }

            te.X = key.x;
            te.Y = key.y;
            te.Z = key.z;

            TagNodeCompound tree = te.BuildTree() as TagNodeCompound;

            _tileTicks.Add(tree);
            _tileTickTable[key] = tree;
        }
Beispiel #6
0
        public TileTick GetTileTick(int x, int y, int z)
        {
            BlockKey key = (TranslateCoordinates != null)
                ? TranslateCoordinates(x, y, z)
                : new BlockKey(x, y, z);

            TagNodeCompound te;

            if (!_tileTickTable.TryGetValue(key, out te))
            {
                return(null);
            }

            if (!te.ContainsKey("i"))
            {
                return(null);
            }

            return(TileTick.FromTreeSafe(te));
        }
Beispiel #7
0
        /// <inheritdoc/>
        public void SetTileTick(int x, int y, int z, TileTick te)
        {
            cache = GetChunk(x, y, z);
            if (cache == null || !Check(x, y, z)) {
                return;
            }

            cache.Blocks.SetTileTick(x & chunkXMask, y & chunkYMask, z & chunkZMask, te);
        }
        internal void SetTileTick(int index, TileTick tt)
        {
            int x, y, z;
            _blocks.GetMultiIndex(index, out x, out y, out z);

            _tileTickManager.SetTileTick(x, y, z, tt);
            _dirty = true;
        }
 /// <inheritdoc/>
 public void SetTileTick(int x, int y, int z, TileTick tt)
 {
     _tileTickManager.SetTileTick(x, y, z, tt);
     _dirty = true;
 }
Beispiel #10
0
        public void SetTileTick(int x, int y, int z, TileTick te)
        {
            if (te.ID != _blocks[x, y, z]) {
                throw new ArgumentException("The TileTick type is not valid for this block.", "te");
            }

            BlockKey key = (TranslateCoordinates != null)
                ? TranslateCoordinates(x, y, z)
                : new BlockKey(x, y, z);

            TagNodeCompound oldte;

            if (_tileTickTable.TryGetValue(key, out oldte)) {
                _tileTicks.Remove(oldte);
            }

            te.X = key.x;
            te.Y = key.y;
            te.Z = key.z;

            TagNodeCompound tree = te.BuildTree() as TagNodeCompound;

            _tileTicks.Add(tree);
            _tileTickTable[key] = tree;
        }
Beispiel #11
0
 /// <summary>
 /// Sets a new <see cref="TileTick"/> record for the block.
 /// </summary>
 /// <param name="te">A <see cref="TileTick"/> record compatible with the block's type.</param>
 public void SetTileTick(TileTick te)
 {
     _collection.SetTileTick(_index, te);
 }