Exemple #1
0
        /// <summary>
        /// Loads the given chunk on the client.
        /// </summary>
        public virtual void LoadChunk(Coordinates2D position)
        {
            var chunk = Entity.World.GetChunk(position);

            SendPacket(ChunkHelper.CreatePacket(chunk));
            // TODO: Tile entities
            foreach (var entity in chunk.TileEntities)
            {
                // ...
            }
            LoadedChunks.Add(position);
        }
Exemple #2
0
        /// <summary>
        /// Loads the given chunk on the client.
        /// </summary>
        public virtual void LoadChunk(Vector3 position)
        {
            World world = Server.EntityManager.GetEntityWorld(Entity);
            Chunk chunk = world.GetChunk(position);

            SendPacket(ChunkHelper.CreatePacket(chunk));
            if (chunk.TileEntities.Count != 0)
            {
                foreach (var tileEntity in chunk.TileEntities)
                {
                    Console.WriteLine("Handling tile entity: " + tileEntity.Value.GetType().Name);
                    if (tileEntity.Value is SignTileEntity)
                    {
                        var signData = tileEntity.Value as SignTileEntity;
                        SendPacket(new UpdateSignPacket((int)tileEntity.Key.X, (short)tileEntity.Key.Y, (int)tileEntity.Key.Z,
                                                        signData.Text1, signData.Text2, signData.Text3, signData.Text4));
                    }
                }
            }
            LoadedChunks.Add(position);
        }