Created
April 14, 2022 17:15
-
-
Save imharvol/4e6b28a0b84d206d3d261cc0839d6bab to your computer and use it in GitHub Desktop.
Gets all item groups of minecraft crafteable items. Requires the decompiled source (https://github.com/PrismarineJS/minecraft-jar-extractor)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path') | |
const fs = require('fs') | |
const recipesPath = path.join(__dirname, './decompiled/assets/minecraft/recipes/') | |
const recipeFileNames = fs.readdirSync(recipesPath) | |
const recipes = recipeFileNames.map(recipeFileName => { | |
return ({ | |
name: recipeFileName, | |
data: JSON.parse(fs.readFileSync(path.join(recipesPath, recipeFileName), 'utf-8')) | |
}) | |
}) | |
let groups = { | |
} | |
for (const recipe of recipes) { | |
if (recipe.data.group) { | |
if (!groups[recipe.data.group]) groups[recipe.data.group] = [] | |
groups[recipe.data.group].push(recipe.name) | |
} | |
} | |
fs.writeFileSync('out.txt', JSON.stringify(groups, null, 2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment