fix: exporting to .litematic errors

This commit is contained in:
trafficlunar 2024-12-27 22:10:45 +00:00
parent 1d59660b01
commit 19e0330c19

View file

@ -67,7 +67,7 @@ function SaveLitematic({ close }: DialogProps) {
filledBlocks.forEach((block) => { filledBlocks.forEach((block) => {
const blockInfo = blockData[block.name.replace("minecraft:", "")]; const blockInfo = blockData[block.name.replace("minecraft:", "")];
let blockName = block.name; let blockName = block.name;
if (blockInfo.id) blockName = blockInfo.id[0].toString(); if (blockInfo) blockName = blockInfo.id[0].toString();
const blockId = blockStatePallete.findIndex((entry) => entry.Name === `minecraft:${blockName}`); const blockId = blockStatePallete.findIndex((entry) => entry.Name === `minecraft:${blockName}`);
@ -141,13 +141,10 @@ function SaveLitematic({ close }: DialogProps) {
setLoading(false); setLoading(false);
const a = document.createElement("a"); const link = document.createElement("a");
a.href = url; link.href = url;
a.download = `${fileName}.litematic`; link.download = `${fileName}.litematic`;
link.click();
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url); URL.revokeObjectURL(url);