fix: bunch of block data fixes

This commit is contained in:
trafficlunar 2025-01-26 17:40:39 +00:00
parent 6883267b95
commit a953914bd3
7 changed files with 207 additions and 79 deletions

View file

@ -16,15 +16,18 @@ Before running any of these scripts you need to have a `blocks` directory with M
1. Run `node scripts/filter.js`
2. Every unneeded texture has been deleted
## resize.js
## fix.js
> Resizes image files bigger than 16x16 (these files are usually for animations such as fire)
> Rotates glazed_terracotta textures and resizes image files bigger than 16x16 (these files are usually for animations such as fire)
1. Run `node scripts/resize.js`
2. Every file has been resized accordingly
1. Run `node scripts/fix.js`
2. Every file has been fixed accordingly
## data.js
> [!IMPORTANT]
> Outdated
> Generates average colors, versions, names, ids, properties for blocks (NEEDS MANUAL EDITING AFTER!)
1. Change the version in `scripts/data.js`

View file

@ -14,7 +14,7 @@
"tall_grass",
".*flower.*",
".*sugar_cane.*",
"structure_block_.*",
"(?!structure_block_load).*structure_block.*",
"stone_slab_top",
".*sapling.*",
".*leaves.*",
@ -38,7 +38,6 @@
"(?!piston_top).*piston.*",
".*peony.*",
".*daisy.*",
"observer_top",
".*portal.*",
"mycelium_top",
".*lilac.*",
@ -105,6 +104,7 @@
"egg",
"smoker_top",
"smoker_bottom",
"smithing_table_side",
"smithing_table_top",
"smithing_table_bottom",
"^(?!.*budding_amethyst).*bud.*",
@ -126,7 +126,7 @@
"mangrove_roots_side",
"propagule",
"loom_top",
"loop_bottom",
"loom_bottom",
"lodestone_top",
"lightning",
"lily",
@ -140,6 +140,7 @@
"grindstone",
"lichen",
"fletching_table_top",
"fletching_table_side",
"fungus",
"creaking_heart_top",
"_triggered",
@ -156,8 +157,6 @@
"azalea",
"_bloom",
"crafter_east",
"crafter_top",
"crafter_bottom",
"^(?!.*cartography_table_side1).*cartography.*",
"_particle",
"_gate",
@ -167,5 +166,6 @@
"dirt_path",
"^(?!.*warped_nylium_side).*warped_nylium.*",
"^(?!.*crimson_nylium_side).*crimson_nylium.*",
"chiseled_bookshelf_top "
"chiseled_bookshelf_top",
"ancient_debris_top"
]

View file

@ -40,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: VERSION_DATA.blocksByName[blockName] ? VERSION_DATA.blocksByName[blockName][property] : "REPLACE_ME_REPLACE_ME_REPLACE_ME_REPLACE_ME",
id: VERSION_DATA.blocksByName[blockName] ? VERSION_DATA.blocksByName[blockName].id : "REPLACE_ME_REPLACE_ME_REPLACE_ME_REPLACE_ME",
color: [color.value[0], color.value[1], color.value[2], color.value[3]],
};
}

View file

@ -12,6 +12,24 @@ const INPUT = path.join(__dirname, "../blocks/");
const image = sharp(filePath);
const metadata = await image.metadata();
if (file.includes("glazed")) {
await image
.rotate(90)
.toBuffer()
.then((buffer) => {
fs.writeFileSync(filePath, buffer);
});
}
if (file.includes("barrel_top")) {
await image
.rotate(180)
.toBuffer()
.then((buffer) => {
fs.writeFileSync(filePath, buffer);
});
}
if (metadata.height > 16) {
await image
.extract({ top: 0, left: 0, width: 16, height: 16 })