prismarine-entity 2.3.1 → 2.5.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,13 @@ returns a `prismarine-item` Item object for the dropped item, if this is a dropp
144
144
 
145
145
  ## History
146
146
 
147
+ ### 2.5.0
148
+ * [add Entity.passengers and Entity.vehicle (#75)](https://github.com/PrismarineJS/prismarine-entity/commit/e45c544e7df6ae69239d1d23473c82805d5134b9) (thanks @qwqtoday)
149
+ * [Bump @types/node from 20.14.15 to 22.2.0 (#80)](https://github.com/PrismarineJS/prismarine-entity/commit/47b7167630665b1d95b5a88c0e985355a640a012) (thanks @dependabot[bot])
150
+
151
+ ### 2.4.0
152
+ * [use getter for `.heldItem` (#73)](https://github.com/PrismarineJS/prismarine-entity/commit/4694438ab733ea3e2d5414d3330ae295ff85b660) (thanks @szdytom)
153
+
147
154
  ### 2.3.1
148
155
  * [Use console.trace instead of console.log for deprecation message (#71)](https://github.com/PrismarineJS/prismarine-entity/commit/7262fcf02d6656c663f876d513d84cc7266a3903) (thanks @extremeheat)
149
156
 
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;
@@ -44,6 +44,8 @@ declare module 'prismarine-entity' {
44
44
  elytraFlying?: boolean
45
45
  player?: object;
46
46
  effects: Effect[];
47
+ vehicle: Entity;
48
+ passengers: Entity[];
47
49
  setEquipment(index: number, item: Item): void;
48
50
  getCustomName(): ChatMessage | null;
49
51
  getDroppedItem(): Item | null;
package/index.js CHANGED
@@ -19,9 +19,10 @@ 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 = []
24
+ this.passengers = []
25
+ this.vehicle = null
25
26
  }
26
27
 
27
28
  get mobType () {
@@ -44,9 +45,12 @@ module.exports = (registryOrVersion) => {
44
45
  this.displayName = name
45
46
  }
46
47
 
48
+ get heldItem () {
49
+ return this.equipment[0]
50
+ }
51
+
47
52
  setEquipment (index, item) {
48
53
  this.equipment[index] = item
49
- this.heldItem = this.equipment[0]
50
54
  }
51
55
 
52
56
  getCustomName () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prismarine-entity",
3
- "version": "2.3.1",
3
+ "version": "2.5.0",
4
4
  "description": "Represent a minecraft entity",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "url": "https://github.com/PrismarineJS/prismarine-entity/issues"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/node": "^20.2.1",
32
+ "@types/node": "^22.2.0",
33
33
  "prismarine-entity": "file:.",
34
34
  "standard": "^17.0.0"
35
35
  }