From a47a591e88b3b170ccb5d18b0ca3851d6eb606f2 Mon Sep 17 00:00:00 2001 From: Manuel_ <58179488+Manuel-3@users.noreply.github.com> Date: Tue, 14 Jul 2026 13:16:35 +0200 Subject: [PATCH] Fix texture properties window crash --- plugins.json | 2 +- plugins/figura_format/figura_format.js | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/plugins.json b/plugins.json index af16c59a..4079a4cb 100644 --- a/plugins.json +++ b/plugins.json @@ -1095,7 +1095,7 @@ "icon": "icon.svg", "description": "Create models for the Figura mod in a custom format that optimizes Blockbench to work with Figura models.", "tags": ["Minecraft: Java Edition", "Figura"], - "version": "0.1.4", + "version": "0.1.5", "min_version": "4.8.0", "variant": "both", "await_loading": true, diff --git a/plugins/figura_format/figura_format.js b/plugins/figura_format/figura_format.js index 7f8eebb1..ae9f817e 100644 --- a/plugins/figura_format/figura_format.js +++ b/plugins/figura_format/figura_format.js @@ -35,6 +35,13 @@ function getValidLuaIndex(str) { return isValidLuaIdentifier(str) ? `.${str}` : `["${str}"]` } + const bbv5 = (()=>{ + let bbv5 = true; + try { + bbv5 = parseInt(Blockbench.version[0]) >= 5; + } catch {} + return bbv5; + })(); BBPlugin.register('figura_format', { title: "Figura Model Format", @@ -42,7 +49,7 @@ icon: "icon.svg", description: "Create models for the Figura mod in a custom format that optimizes Blockbench to work with Figura models.", tags: ["Minecraft: Java Edition", "Figura"], - version: "0.1.4", + version: "0.1.5", min_version: "4.8.0", variant: "both", await_loading: true, @@ -114,11 +121,11 @@ click() { let path = [] let element - if (parseInt(Blockbench.version[0]) < 5) { - element = Group.selected || Outliner.selected[0] // < v5 + if (bbv5) { + element = Group.selected[0] || Outliner.selected[0] // >= v5 } else { - element = Group.selected[0] || Outliner.selected[0] // >= v5 + element = Group.selected || Outliner.selected[0] // < v5 } while (element !== "root") { path.unshift(element.name) @@ -534,7 +541,8 @@ // In the Texture Properties Dialog specifically, remove the Render Mode field const DialogBuild = Dialog.prototype.build Dialog.prototype.build = function () { - if (Format === format && this.id == 'texture_edit') delete this.form.render_mode + if (!bbv5 && Format === format && this.id == 'texture_edit') delete this.form.render_mode + if (bbv5 && Format === format && this.id == 'texture_edit') delete this.form_config.render_mode DialogBuild.call(this) }