aboutsummaryrefslogtreecommitdiff
path: root/src/extension.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/extension.ts')
-rw-r--r--src/extension.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/extension.ts b/src/extension.ts
new file mode 100644
index 0000000..05b6ab8
--- /dev/null
+++ b/src/extension.ts
@@ -0,0 +1,29 @@
+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() { }