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
2
.github/workflows/ntfy.yaml
vendored
2
.github/workflows/ntfy.yaml
vendored
|
|
@ -3,7 +3,7 @@ on: [deployment_status]
|
|||
|
||||
jobs:
|
||||
notify:
|
||||
if: github.event.deployment_status.state == 'failure' | github.event.deployment_status.state == 'success'
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Notify on Success
|
||||
|
|
|
|||
|
|
@ -28,10 +28,6 @@ const data = {};
|
|||
const pattern = new RegExp(nameRegex.join("|"), "g");
|
||||
const blockName = fileName.replace(pattern, "");
|
||||
|
||||
function getDataBlockProperty(property) {
|
||||
return VERSION_DATA.blocksByName[blockName] ? VERSION_DATA.blocksByName[blockName][property] : "REPLACE_ME_REPLACE_ME_REPLACE_ME_REPLACE_ME";
|
||||
}
|
||||
|
||||
function getVersion() {
|
||||
for (const key of Object.keys(versionRegex)) {
|
||||
if (blockName.includes(key)) {
|
||||
|
|
@ -44,7 +40,7 @@ const data = {};
|
|||
data[fileName] = {
|
||||
name: VERSION_DATA.blocksByName[fileName] ? VERSION_DATA.blocksByName[fileName].displayName : "REPLACE_ME_REPLACE_ME_REPLACE_ME_REPLACE_ME",
|
||||
version: getVersion(),
|
||||
id: [getDataBlockProperty("name"), getDataBlockProperty("id")],
|
||||
id: VERSION_DATA.blocksByName[blockName] ? VERSION_DATA.blocksByName[blockName][property] : "REPLACE_ME_REPLACE_ME_REPLACE_ME_REPLACE_ME",
|
||||
color: [color.value[0], color.value[1], color.value[2], color.value[3]],
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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…
Reference in a new issue