prismarine-windows 2.5.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/HISTORY.md +9 -1
  2. package/index.js +10 -6
  3. package/package.json +2 -2
package/HISTORY.md CHANGED
@@ -1,6 +1,14 @@
1
+ ## 2.6.1
2
+
3
+ * fix typo
4
+
5
+ ## 2.6.0
6
+
7
+ * mcData to registry refactoring + anticipation of feature check refactoring
8
+
1
9
  ## 2.5.0
2
10
 
3
- * Extend the events used for windows
11
+ * Extend the events used for windows
4
12
 
5
13
  ## 2.4.4
6
14
  * update mcdata
package/index.js CHANGED
@@ -1,10 +1,11 @@
1
- function loader (mcVersion) {
2
- const Item = require('prismarine-item')(mcVersion)
1
+ function loader (registryOrVersion) {
2
+ const registry = typeof registryOrVersion === 'string' ? require('prismarine-registry')(registryOrVersion) : registryOrVersion
3
+ const Item = require('prismarine-item')(registry)
3
4
  const Window = require('./lib/Window')(Item)
4
- const mcData = require('minecraft-data')(mcVersion)
5
5
 
6
6
  let windows
7
- if (mcData.isNewerOrEqualTo('1.14')) {
7
+ // if (registry.supportFeature("village&pillageInventoryWindows")) {
8
+ if (registry.isNewerOrEqualTo('1.14')) { // this line should be discarded for the one above when the corresponding feature is added to minecraft-data
8
9
  // https://wiki.vg/Inventory
9
10
  windows = {}
10
11
  let protocolId = -1
@@ -29,7 +30,8 @@ function loader (mcVersion) {
29
30
  windows['minecraft:loom'] = { type: protocolId++, inventory: { start: 4, end: 39 }, slots: 40, craft: 3, requireConfirmation: true }
30
31
  windows['minecraft:merchant'] = { type: protocolId++, inventory: { start: 3, end: 38 }, slots: 39, craft: 2, requireConfirmation: true }
31
32
  windows['minecraft:shulker_box'] = { type: protocolId++, inventory: { start: 27, end: 62 }, slots: 63, craft: -1, requireConfirmation: true }
32
- if (mcData.isNewerOrEqualTo('1.16')) {
33
+ // if (registry.supportFeature("netherUpdateInventoryWindows")) {
34
+ if (registry.isNewerOrEqualTo('1.16')) { // this line should be discarded for the one above when the corresponding feature is added to minecraft-data
33
35
  windows['minecraft:smithing'] = { type: protocolId++, inventory: { start: 3, end: 38 }, slots: 39, craft: 2, requireConfirmation: true }
34
36
  }
35
37
  windows['minecraft:smoker'] = { type: protocolId++, inventory: { start: 3, end: 38 }, slots: 39, craft: 2, requireConfirmation: true }
@@ -37,8 +39,10 @@ function loader (mcVersion) {
37
39
  windows['minecraft:stonecutter'] = { type: protocolId++, inventory: { start: 2, end: 37 }, slots: 38, craft: 1, requireConfirmation: true }
38
40
  } else {
39
41
  // https://wiki.vg/index.php?title=Inventory&oldid=14093
42
+ // const inventorySlots = registry.supportFeature("shieldSlot") ? 46 : 45
43
+ const inventorySlots = registry.isNewerOrEqualTo('1.9') ? 46 : 45// this line should be discarded for the one above when the corresponding feature is added to minecraft-data
40
44
  windows = {
41
- 'minecraft:inventory': { type: 'minecraft:inventory', inventory: { start: 9, end: 44 }, slots: mcData.isNewerOrEqualTo('1.9') ? 46 : 45, craft: 0, requireConfirmation: true },
45
+ 'minecraft:inventory': { type: 'minecraft:inventory', inventory: { start: 9, end: 44 }, slots: inventorySlots, craft: 0, requireConfirmation: true },
42
46
  'minecraft:chest': null,
43
47
  'minecraft:crafting_table': { type: 'minecraft:crafting_table', inventory: { start: 10, end: 45 }, slots: 46, craft: 0, requireConfirmation: true },
44
48
  'minecraft:furnace': { type: 'minecraft:furnace', inventory: { start: 3, end: 38 }, slots: 39, craft: 2, requireConfirmation: true },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prismarine-windows",
3
- "version": "2.5.0",
3
+ "version": "2.6.1",
4
4
  "description": "Represent minecraft windows",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -13,7 +13,7 @@
13
13
  "url": "git+ssh://git@github.com/PrismarineJS/prismarine-windows.git"
14
14
  },
15
15
  "dependencies": {
16
- "minecraft-data": "^3.0.0",
16
+ "prismarine-registry": "^1.5.0",
17
17
  "prismarine-item": "^1.5.0",
18
18
  "typed-emitter": "^1.0.0"
19
19
  },