prismarine-entity 2.3.0 → 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,12 @@ 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
+
150
+ ### 2.3.1
151
+ * [Use console.trace instead of console.log for deprecation message (#71)](https://github.com/PrismarineJS/prismarine-entity/commit/7262fcf02d6656c663f876d513d84cc7266a3903) (thanks @extremeheat)
152
+
147
153
  ### 2.3.0
148
154
  * [Add default elytra flying value (#69)](https://github.com/PrismarineJS/prismarine-entity/commit/f124abd47b42a908a676b91b0fcb55b1fd1a77b9) (thanks @lkwilson)
149
155
  * [Fix equipment documentation for other versions (#67)](https://github.com/PrismarineJS/prismarine-entity/commit/b2f756de52fa7ceb2675fe9c2f950fa7398bc425) (thanks @IceTank)
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 () {
@@ -68,8 +70,8 @@ module.exports = (registryOrVersion) => {
68
70
  return Entity
69
71
  }
70
72
  function printMobTypeWarning () {
71
- console.log('Warning: entity.mobType is deprecated. Use entity.displayName instead')
73
+ console.trace('Warning: entity.mobType is deprecated. Use entity.displayName instead')
72
74
  }
73
75
  function printObjectTypeWarning () {
74
- console.log('Warning: entity.objectType is deprecated. Use entity.displayName instead')
76
+ console.trace('Warning: entity.objectType is deprecated. Use entity.displayName instead')
75
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prismarine-entity",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Represent a minecraft entity",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",