import * as vscode from 'vscode'; export function activate(context: vscode.ExtensionContext) { let disposable = vscode.commands.registerCommand('neudevtools.encodeSkull', async () => { const answer = await vscode.window.showInputBox({ prompt: "Enter the texture id or skin url" }); if (!answer) { vscode.window.showErrorMessage("Please input a skin texture id"); return; } let url; if (!answer.startsWith("http://") && !answer.startsWith("https://")) { url = `http://textures.minecraft.net/texture/${answer}`; } else { url = answer; } const toEncode = `{"textures":{"SKIN":{"url":${JSON.stringify(url)}}}}`; console.log(`Encoding : ${toEncode}`); const encoded = Buffer.from(toEncode).toString('base64'); console.log(`Encoded: ${encoded}`); await vscode.window.activeTextEditor?.insertSnippet(new vscode.SnippetString().appendText(encoded)); }); context.subscriptions.push(disposable); } export function deactivate() { }