Commit d7224a3 1 parent 776ea90 commit d7224a3 Copy full SHA for d7224a3
File tree 2 files changed +6
-5
lines changed
2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 1
1
const Vec3 = require ( 'vec3' ) . Vec3
2
2
const EventEmitter = require ( 'events' ) . EventEmitter
3
3
4
- module . exports = ( version ) => {
5
- const ChatMessage = require ( 'prismarine-chat ' ) ( version )
6
- const Item = require ( 'prismarine-item ' ) ( version )
7
- const mcData = require ( 'minecraft-data ' ) ( version )
4
+ module . exports = ( registryOrVersion ) => {
5
+ const registry = typeof registryOrVersion === 'string' ? require ( 'prismarine-registry ' ) ( registryOrVersion ) : registryOrVersion
6
+ const ChatMessage = require ( 'prismarine-chat ' ) ( registry )
7
+ const Item = require ( 'prismarine-item ' ) ( registry )
8
8
class Entity extends EventEmitter {
9
9
constructor ( id ) {
10
10
super ( )
@@ -41,7 +41,7 @@ module.exports = (version) => {
41
41
if ( this . name !== 'item' && this . name !== 'Item' && this . name !== 'item_stack' ) {
42
42
return null // not a dropped item
43
43
}
44
- return Item . fromNotch ( this . metadata [ mcData . supportFeature ( 'metadataIxOfItem' ) ] )
44
+ return Item . fromNotch ( this . metadata [ registry . supportFeature ( 'metadataIxOfItem' ) ] )
45
45
}
46
46
}
47
47
Original file line number Diff line number Diff line change 16
16
"minecraft-data" : " ^3.0.0" ,
17
17
"prismarine-chat" : " ^1.4.1" ,
18
18
"prismarine-item" : " ^1.11.2" ,
19
+ "prismarine-registry" : " ^1.4.0" ,
19
20
"vec3" : " ^0.1.4"
20
21
},
21
22
"keywords" : [
You can’t perform that action at this time.
0 commit comments