Ejemplo n.º 1
0
        public void SetTileEntity(int x, int y, int z, TileEntity te)
        {
            BlockInfoEx info = BlockInfo.BlockTable[_blocks[x, y, z]] as BlockInfoEx;

            if (info == null)
            {
                throw new InvalidOperationException("The given block is of a type that does not support TileEntities.");
            }

            if (te.GetType() != TileEntityFactory.Lookup(info.TileEntityName))
            {
                throw new ArgumentException("The TileEntity type is not valid for this block.", "te");
            }

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

            TagNodeCompound oldte;

            if (_tileEntityTable.TryGetValue(key, out oldte))
            {
                _tileEntities.Remove(oldte);
            }

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

            TagNodeCompound tree = te.BuildTree() as TagNodeCompound;

            _tileEntities.Add(tree);
            _tileEntityTable[key] = tree;
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
        public bool DeleteTag(TagNode tag)
        {
            bool result = _tag.Remove(tag);

            if (result)
            {
                SetModified();
            }

            return(result);
        }
Ejemplo n.º 4
0
 public bool DeleteTag(TagNode tag)
 {
     return(_tag.Remove(tag));
 }