prismarine-entity 2.3.1 → 2.4.0

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.
package/README.md CHANGED
@@ -144,6 +144,9 @@ returns a `prismarine-item` Item object for the dropped item, if this is a dropp
144
144
 
145
145
  ## History
146
146
 
147
+ ### 2.4.0
148
+ * [use getter for `.heldItem` (#73)](https://github.com/PrismarineJS/prismarine-entity/commit/4694438ab733ea3e2d5414d3330ae295ff85b660) (thanks @szdytom)
149
+
147
150
  ### 2.3.1
148
151
  * [Use console.trace instead of console.log for deprecation message (#71)](https://github.com/PrismarineJS/prismarine-entity/commit/7262fcf02d6656c663f876d513d84cc7266a3903) (thanks @extremeheat)
149
152
 
package/index.d.ts CHANGED
@@ -35,7 +35,7 @@ declare module 'prismarine-entity' {
35
35
  width: number;
36
36
  onGround: boolean;
37
37
  equipment: Array<Item>;
38
- heldItem: Item;
38
+ get heldItem(): Item;
39
39
  metadata: Array<object>;
40
40
  isValid: boolean;
41
41
  health?: number;
package/index.js CHANGED
@@ -19,7 +19,6 @@ module.exports = (registryOrVersion) => {
19
19
  this.effects = {}
20
20
  // 0 = held item, 1-4 = armor slot
21
21
  this.equipment = new Array(5)
22
- this.heldItem = this.equipment[0] // shortcut to equipment[0]
23
22
  this.isValid = true
24
23
  this.metadata = []
25
24
  }
@@ -44,9 +43,12 @@ module.exports = (registryOrVersion) => {
44
43
  this.displayName = name
45
44
  }
46
45
 
46
+ get heldItem () {
47
+ return this.equipment[0]
48
+ }
49
+
47
50
  setEquipment (index, item) {
48
51
  this.equipment[index] = item
49
- this.heldItem = this.equipment[0]
50
52
  }
51
53
 
52
54
  getCustomName () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prismarine-entity",
3
- "version": "2.3.1",
3
+ "version": "2.4.0",
4
4
  "description": "Represent a minecraft entity",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",