From c4a91c84b7cd3ca934373f6adee88bf03ea11bdf Mon Sep 17 00:00:00 2001 From: Epirito <96730122+Epirito@users.noreply.github.com> Date: Tue, 11 Oct 2022 11:33:57 -0300 Subject: [PATCH] mcData to registry refactoring (step towards mineflayer issue #2450) (#16) * Update index.js * Update recipe.js * mcData to registry refactoring * Update package.json * Update package.json --- index.js | 5 +++-- lib/recipe.js | 4 ++-- package.json | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 74ffd75..0dc38dd 100644 --- a/index.js +++ b/index.js @@ -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') } } diff --git a/lib/recipe.js b/lib/recipe.js index e2f3e8a..4aff763 100644 --- a/lib/recipe.js +++ b/lib/recipe.js @@ -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 } diff --git a/package.json b/package.json index 76d6eab..8bf9f6f 100644 --- a/package.json +++ b/package.json @@ -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": [