Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mcData to registry refactoring (step towards #2450) #50

Merged
merged 2 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -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')])
}
}

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"minecraft-data": "^3.0.0",
"prismarine-chat": "^1.4.1",
"prismarine-item": "^1.11.2",
"prismarine-registry": "^1.4.0",
"vec3": "^0.1.4"
},
"keywords": [
Expand Down