From 53bfb7bea14034077e277b28136d103cf1159b6f Mon Sep 17 00:00:00 2001 From: Epirito <96730122+Epirito@users.noreply.github.com> Date: Tue, 11 Oct 2022 10:12:42 -0300 Subject: [PATCH 1/2] mcData to registry refactoring --- index.js | 10 +++++----- package.json | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 5cdae09..9a98c2a 100644 --- a/index.js +++ b/index.js @@ -1,10 +1,10 @@ const Vec3 = require('vec3').Vec3 const EventEmitter = require('events').EventEmitter -module.exports = (version) => { - const ChatMessage = require('prismarine-chat')(version) - const Item = require('prismarine-item')(version) - const mcData = require('minecraft-data')(version) +module.exports = (registryOrVersion) => { + const registry = typeof registryOrVersion === 'string' ? require('prismarine-registry')(registryOrVersion) : registryOrVersion + const ChatMessage = require('prismarine-chat')(registry) + const Item = require('prismarine-item')(registry) class Entity extends EventEmitter { constructor (id) { super() @@ -41,7 +41,7 @@ module.exports = (version) => { if (this.name !== 'item' && this.name !== 'Item' && this.name !== 'item_stack') { return null // not a dropped item } - return Item.fromNotch(this.metadata[mcData.supportFeature('metadataIxOfItem')]) + return Item.fromNotch(this.metadata[registry.supportFeature('metadataIxOfItem')]) } } diff --git a/package.json b/package.json index fd493bb..cf26f7d 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "minecraft-data": "^3.0.0", "prismarine-chat": "^1.4.1", "prismarine-item": "^1.11.2", + "prismarine-registry": "^1.5.0", "vec3": "^0.1.4" }, "keywords": [ From 9ec32739eb314348905f559d983fe9042fb162fa Mon Sep 17 00:00:00 2001 From: Epirito <96730122+Epirito@users.noreply.github.com> Date: Tue, 11 Oct 2022 10:16:48 -0300 Subject: [PATCH 2/2] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cf26f7d..25a1fa5 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "minecraft-data": "^3.0.0", "prismarine-chat": "^1.4.1", "prismarine-item": "^1.11.2", - "prismarine-registry": "^1.5.0", + "prismarine-registry": "^1.4.0", "vec3": "^0.1.4" }, "keywords": [