コード例 #1
0
        /// <summary>
        /// Handling of chunk blocks data change
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void BlockDataChanged(object sender, ChunkDataProviderDataChangedEventArgs e)
        {
            PureGenerated = false;

            OnBlocksChanged(e);

            base.BlockDataChanged(sender, e);
        }
コード例 #2
0
        void ChunkBlocksChanged(object sender, ChunkDataProviderDataChangedEventArgs e)
        {
            var ea = new ServerLandscapeManagerBlockChangedEventArgs((IAbstractChunk)sender, e);

            OnBlockChanged(ea);
            var serverChunk = (ServerChunk)sender;

            RequestSave(serverChunk);
        }
コード例 #3
0
        private void OnBlocksChanged(ChunkDataProviderDataChangedEventArgs e)
        {
            var handler = BlocksChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }
        public ServerLandscapeManagerBlockChangedEventArgs(IAbstractChunk chunk, ChunkDataProviderDataChangedEventArgs e)
        {
            Count = e.Count;

            Locations = new Vector3I[Count];
            e.Locations.CopyTo(Locations, 0);
            BlockHelper.ConvertToGlobal(chunk.Position, Locations);

            Values = e.Bytes;

            if (e.Tags != null)
            {
                Tags = e.Tags;
            }
        }
コード例 #5
0
        void ChunkBlocksChanged(object sender, ChunkDataProviderDataChangedEventArgs e)
        {
            var chunk = (ServerChunk)sender;

            chunk.LastAccess = DateTime.Now;

            var globalPos = new Vector3I[e.Locations.Length];

            e.Locations.CopyTo(globalPos, 0);
            BlockHelper.ConvertToGlobal(chunk.Position, globalPos);

            // tell entities about blocks change
            var eargs = new BlocksChangedEventArgs
            {
                ChunkPosition   = chunk.Position,
                BlockValues     = e.Bytes,
                Locations       = e.Locations,
                GlobalLocations = globalPos,
                Tags            = e.Tags,
                SourceEntityId  = e.SourceDynamicId
            };

            GetArea(new Vector3D(eargs.ChunkPosition.X * AbstractChunk.ChunkSize.X, 0, eargs.ChunkPosition.Z * AbstractChunk.ChunkSize.Z)).OnBlocksChanged(eargs);
        }