Skip to content

Commit

Permalink
Fixed loading models without a vanilla texture
Browse files Browse the repository at this point in the history
  • Loading branch information
ewanhowell5195 committed Jul 25, 2024
1 parent 4a2b0ec commit 07c04ad
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
19 changes: 12 additions & 7 deletions plugins/cem_template_loader/cem_template_loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
author: "Ewan Howell",
description: description + " Also includes an animation editor, so that you can create custom entity animations.",
tags: ["Minecraft: Java Edition", "OptiFine", "Templates"],
version: "8.1.0",
version: "8.1.1",
min_version: "4.10.0",
variant: "both",
creation_date: "2020-02-02",
Expand Down Expand Up @@ -639,22 +639,27 @@
if (!textureLoaded) {
const textureData = Array.isArray(model.texture_data) ? model.texture_data : [model.texture_data]
const textures = Array.isArray(data.texture_name) && Array.isArray(model.texture_data) ? data.texture_name : [data.texture_name ?? data.name]
for (const cube of Cube.all) {
cube.selectLow()
}
for (const [i, name] of textures.entries()) {
let tex
if (textureData[i]) {
tex = new Texture({ name }).fromDataURL("data:image/png;base64," + textureData[i]).add()
new Texture({ name }).fromDataURL("data:image/png;base64," + textureData[i]).add()
} else {
tex = TextureGenerator.addBitmap({
TextureGenerator.addBitmap({
name,
color: new tinycolor("#00000000"),
type: "template",
rearrange_uv: false,
resolution: "16"
})
}
if (!i && textures.length === 1) {
tex.use_as_default = true
}
}
for (const cube of Cube.all) {
cube.unselect()
}
if (textures.length > 1) {
Texture.all.forEach(t => t.use_as_default = false)
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions plugins/cem_template_loader/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -881,5 +881,18 @@
]
}
]
},
"8.1.1": {
"title": "8.1.1",
"date": "2024-07-25",
"author": "Ewan Howell",
"categories": [
{
"title": "Bug Fixes",
"list": [
"Fixed loading models without a vanilla texture"
]
}
]
}
}

0 comments on commit 07c04ad

Please sign in to comment.