fix preview block & item textures

This commit is contained in:
ZXMushroom63
2025-03-18 15:53:26 +08:00
parent 63a2ba2b8e
commit d56af17d25
2 changed files with 14 additions and 3 deletions

View File

@@ -2553,7 +2553,11 @@ function blockL10NToId(thisSentence, noReverse) {
}
function getImageLocationItem(item, display) {
if ((item.name === "missingno") && !display) {
return "missingno";
var tex = state.nodes.find(x => x.type === "item" && x.tags.id == item.id)?.tags?.texture;
if (!tex || tex.startsWith("efb::")) {
return "missingno";
}
return tex;
}
item = Object.assign({}, item);
item.id = item.id.replace("record", "music_disc");
@@ -2597,7 +2601,11 @@ function getImageLocationItem(item, display) {
}
function getImageLocationBlock(block, display) {
if ((block.name === "missingno") && !display) {
return "missingno";
var tex = state.nodes.find(x => x.type === "block_advanced" && x.tags.id == block.id)?.tags?.texture;
if (!tex || tex.startsWith("efb::")) {
return "missingno";
}
return tex;
}
block = Object.assign({}, block);
block.name = block.name.replaceAll("big_oak", "dark_oak");
@@ -2729,6 +2737,9 @@ function getImageLocationBlock(block, display) {
}
}
function getImageLocation(id) {
if (id.startsWith("data:")) {
return id;
}
if (id === "item/air") {
return emptyTexture;
}

View File

@@ -110,7 +110,7 @@ function editObject(obj, datablock) {
}
}
if (typeof parentValue === "string" && parentValue.startsWith("efb::val")) {
if (typeof parentValue === "string" && ["efb::val__file", "efb::val__img"].includes(parentValue)) {
var resetBtn = document.createElement("button");
resetBtn.innerText = "Reset";
resetBtn.addEventListener("click", ()=>{