SubstrateCS/Source/AnvilChunk.cs
/// <summary>
/// Updates the chunk's global world coordinates.
/// </summary>
/// <param name="x">Global X-coordinate.</param>
/// <param name="z">Global Z-coordinate.</param>
Updates the chunk's global world coordinates.
Updates the chunk ' s global world coordinates .
public virtual void SetLocation(int x, int z)
        {
            int diffx = (x - _cx) * XDIM;
            int diffz = (z - _cz) * ZDIM;
            _cx = x;
            _cz = z;
            _tree.Root["Level"].ToTagCompound()["xPos"].ToTagInt().Data = x;
            _tree.Root["Level"].ToTagCompound()["zPos"].ToTagInt().Data = z;
            List<TileEntity> tileEntites = new List<TileEntity>();
            foreach (TagNodeCompound tag in _tileEntities)
            {
                TileEntity te = TileEntityFactory.Create(tag);
                if (te == null)
                {
                    te = TileEntity.FromTreeSafe(tag);
                }
                if (te != null)
                {
                    te.MoveBy(diffx, 0, diffz);
                    tileEntites.Add(te);
                }
            }
            _tileEntities.Clear();
            foreach (TileEntity te in tileEntites)
            {
                _tileEntities.Add(te.BuildTree());
            }
            if (_tileTicks != null)
            {
                List<TileTick> tileTicks = new List<TileTick>();
                foreach (TagNodeCompound tag in _tileTicks)
                {
                    TileTick tt = TileTick.FromTreeSafe(tag);
                    if (tt != null)
                    {
                        tt.MoveBy(diffx, 0, diffz);
                        tileTicks.Add(tt);
                    }
                }
                _tileTicks.Clear();
                foreach (TileTick tt in tileTicks)
                {
                    _tileTicks.Add(tt.BuildTree());
                }
            }
            List<TypedEntity> entities = new List<TypedEntity>();
            foreach (TypedEntity entity in _entityManager)
            {
                entity.MoveBy(diffx, 0, diffz);
                entities.Add(entity);
            }
            _entities.Clear();
            foreach (TypedEntity entity in entities)
            {
                _entityManager.Add(entity);
            }
        }
public virtual void SetLocation ( int x , int z ) { int diffx = ( x - _cx ) * XDIM ; int diffz = ( z - _cz ) * ZDIM ; _cx = x ; _cz = z ; _tree . Root [ " " ] . ToTagCompound ( ) [ " " ] . ToTagInt ( ) . Data = x ; _tree . Root [ " " ] . ToTagCompound ( ) [ " " ] . ToTagInt ( ) . Data = z ; List < TileEntity > tileEntites = new List < TileEntity > ( ) ; foreach ( TagNodeCompound tag in _tileEntities ) { TileEntity te = TileEntityFactory . Create ( tag ) ; if ( te == null ) { te = TileEntity . FromTreeSafe ( tag ) ; } if ( te != null ) { te . MoveBy ( diffx , 0 , diffz ) ; tileEntites . Add ( te ) ; } } _tileEntities . Clear ( ) ; foreach ( TileEntity te in tileEntites ) { _tileEntities . Add ( te . BuildTree ( ) ) ; } if ( _tileTicks != null ) { List < TileTick > tileTicks = new List < TileTick > ( ) ; foreach ( TagNodeCompound tag in _tileTicks ) { TileTick tt = TileTick . FromTreeSafe ( tag ) ; if ( tt != null ) { tt . MoveBy ( diffx , 0 , diffz ) ; tileTicks . Add ( tt ) ; } } _tileTicks . Clear ( ) ; foreach ( TileTick tt in tileTicks ) { _tileTicks . Add ( tt . BuildTree ( ) ) ; } } List < TypedEntity > entities = new List < TypedEntity > ( ) ; foreach ( TypedEntity entity in _entityManager ) { entity . MoveBy ( diffx , 0 , diffz ) ; entities . Add ( entity ) ; } _entities . Clear ( ) ; foreach ( TypedEntity entity in entities ) { _entityManager . Add ( entity ) ; } }
Updates the chunk's global world coordinates.
Updates the chunk ' s global world coordinates .
// Update chunk position // Update tile entity coordinates // Update tile tick coordinates // Update entity coordinates
x
int
None
z
int
None