Beispiel #1
0
        public void OnBlocksChanged(BlocksChangedEventArgs e)
        {
            var handler = BlocksChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Beispiel #2
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);
        }