/// <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); var dataPacket = new ChunkDataPacket(ref chunk); SendPacket(dataPacket); 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) SendPacket(new UpdateSignPacket(tileEntity.Key, tileEntity.Value as SignTileEntity)); } } this.LoadedChunks.Add(position); }
/// <summary> /// Unloads the given chunk on the client. /// </summary> public virtual void UnloadChunk(Vector3 position) { var dataPacket = new ChunkDataPacket(); dataPacket.AddBitMap = 0; dataPacket.GroundUpContiguous = true; dataPacket.PrimaryBitMap = 0; dataPacket.X = (int)position.X; dataPacket.Z = (int)position.Z; dataPacket.CompressedData = ChunkDataPacket.ChunkRemovalSequence; SendPacket(dataPacket); this.LoadedChunks.Remove(position); }
/// <summary> /// Loads the given chunk on the client. /// </summary> public void LoadChunk(Vector3 position) { World world = Server.GetClientWorld(this); Chunk chunk = world.GetChunk(position); var dataPacket = new ChunkDataPacket(ref chunk); SendPacket(dataPacket); this.LoadedChunks.Add(position); }