Skip to content

Instantly share code, notes, and snippets.

@imharvol
Created April 14, 2022 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imharvol/4e6b28a0b84d206d3d261cc0839d6bab to your computer and use it in GitHub Desktop.
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)
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