Skip to content

Commit

Permalink
mcData to registry refactoring (step towards mineflayer issue #2450) (#…
Browse files Browse the repository at this point in the history
…16)

* Update index.js

* Update recipe.js

* mcData to registry refactoring

* Update package.json

* Update package.json
  • Loading branch information
Epirito authored Oct 11, 2022
1 parent 21eb71a commit c4a91c8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
function loader (mcVersion) {
function loader (registryOrVersion) {
const registry = typeof registryOrVersion === 'string' ? require('prismarine-registry')(registryOrVersion) : registryOrVersion
return {
Recipe: require('./lib/recipe')(mcVersion),
Recipe: require('./lib/recipe')(registry),
RecipeItem: require('./lib/recipe_item')
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/recipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const RecipeItem = require('./recipe_item')

module.exports = loader

function loader (mcVersion) {
recipes = require('minecraft-data')(mcVersion).recipes
function loader (registry) {
recipes = registry.recipes
return Recipe
}

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
"url": "git+ssh://git@github.com/PrismarineJS/prismarine-recipe.git"
},
"peerDependencies": {
"minecraft-data": "^3.0.0"
"prismarine-registry": "^1.4.0"
},
"devDependencies": {
"minecraft-data": "^3.0.0",
"standard": "^17.0.0"
},
"keywords": [
Expand Down

0 comments on commit c4a91c8

Please sign in to comment.