public static void LevelFinalize(RemoteClient client, Proxy proxy, IPacket _packet) { var packet = (LevelFinalizePacket)_packet; client.SendChat(ChatColors.Yellow + "Download complete. Converting world to Anvil."); if (packet.YSize > 256) { client.SendChat(ChatColors.Red + "Warning! Level is taller than maximum 1.6.2 world height."); client.SendChat(ChatColors.Red + "The top of the world will be cut off."); } proxy.FlushClient(client); WorldConverter.PopulateWorld(client.Level.DefaultWorld, client.ClassicLevelData, packet.XSize, packet.YSize, packet.ZSize); client.SendPacket(new Modern.RespawnPacket(Dimension.Overworld, Difficulty.Normal, GameMode.Creative, 256, "FLAT")); for (int x = 0; x < packet.XSize / 16; x++) { for (int z = 0; z < packet.ZSize / 16; z++) { client.SendPacket(ChunkHelper.CreatePacket(client.Level.DefaultWorld.GetChunk( new Coordinates2D(x, z)))); } } client.SendPacket(new Modern.PlayerPositionAndLookPacket( client.Position.X, client.Position.Y + 1.72, client.Position.Z, client.Position.Y + 0.1, 0, 0, false)); client.SendChat(ChatColors.Yellow + "Conversion complete. Welcome to RetroCraft."); }
public ClassicLevel(byte[] classicData, short width, short height, short depth) { Blocks = new byte[width * depth * height]; Metadata = new byte[width * depth * height]; this.Width = width; this.Height = height; this.Depth = depth; for (int i = 4; i < Blocks.Length; i++) { Blocks[i] = WorldConverter.TranslateId(classicData[i])[0]; Metadata[i] = WorldConverter.TranslateId(classicData[i])[1]; } }