mirror of
https://github.com/trafficlunar/blockmatic.git
synced 2026-06-28 06:34:13 +00:00
fix: convert id array to single string in block data
This commit is contained in:
parent
2500a00e21
commit
e5ee9c81a9
7 changed files with 447 additions and 452 deletions
|
|
@ -96,8 +96,7 @@ function OpenSchematic({ close }: DialogProps) {
|
|||
if (blockId == "air") continue;
|
||||
|
||||
for (const name in blockData) {
|
||||
const dataId = blockData[name].id[0];
|
||||
if (dataId !== blockId) continue;
|
||||
if (blockData[name].id !== blockId) continue;
|
||||
|
||||
const paletteProperties = paletteBlock.Properties;
|
||||
const dataProperties = blockData[name].properties;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ function SaveLitematic({ close }: DialogProps) {
|
|||
blocks.map((block) => {
|
||||
const blockInfo = blockData[block.name.replace("minecraft:", "")];
|
||||
const returnData: { Name: string; Properties?: Record<string, string> } = {
|
||||
Name: `minecraft:${blockInfo.id[0]}`,
|
||||
Name: `minecraft:${blockInfo.id}`,
|
||||
...(blockInfo.properties ? { Properties: blockInfo.properties } : {}),
|
||||
};
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ function SaveLitematic({ close }: DialogProps) {
|
|||
|
||||
filledBlocks.forEach((block) => {
|
||||
const blockInfo = blockData[block.name.replace("minecraft:", "")];
|
||||
const blockName = blockInfo ? blockInfo.id[0].toString() : block.name;
|
||||
const blockName = blockInfo ? blockInfo.id : block.name;
|
||||
|
||||
const blockId = blockStatePalette.findIndex((entry) => entry.Name === `minecraft:${blockName}`);
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ function SaveLitematic({ close }: DialogProps) {
|
|||
.map(([key, value]) => `${key}=${value}`)
|
||||
.join(",")}]`
|
||||
: "";
|
||||
return `minecraft:${blockInfo.id[0]}${properties}`;
|
||||
return `minecraft:${blockInfo}${properties}`;
|
||||
})
|
||||
)
|
||||
).reduce<Record<string, nbt.Int32<number>>>((acc, blockName, index) => {
|
||||
|
|
@ -72,7 +72,7 @@ function SaveLitematic({ close }: DialogProps) {
|
|||
|
||||
filledBlocks.forEach((block, index) => {
|
||||
const blockInfo = blockData[block.name.replace("minecraft:", "")];
|
||||
const blockName = blockInfo ? blockInfo.id[0].toString() : block.name;
|
||||
const blockName = blockInfo ? blockInfo.id : block.name;
|
||||
const properties = blockInfo.properties
|
||||
? `[${Object.entries(blockInfo.properties)
|
||||
.map(([key, value]) => `${key}=${value}`)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
2
src/types.d.ts
vendored
2
src/types.d.ts
vendored
|
|
@ -41,7 +41,7 @@ type BlockData = Record<
|
|||
{
|
||||
name: string;
|
||||
version: number;
|
||||
id: (string | number)[];
|
||||
id: string;
|
||||
color: number[];
|
||||
fallable?: boolean;
|
||||
creative?: boolean;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue