prismarine-entity 2.1.1 → 2.3.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.
@@ -13,7 +13,7 @@ jobs:
13
13
 
14
14
  strategy:
15
15
  matrix:
16
- node-version: [12.x]
16
+ node-version: [18.x]
17
17
 
18
18
  steps:
19
19
  - uses: actions/checkout@v2
@@ -0,0 +1,22 @@
1
+ name: Repo Commands
2
+
3
+ on:
4
+ issue_comment: # Handle comment commands
5
+ types: [created]
6
+ pull_request: # Handle renamed PRs
7
+ types: [edited]
8
+
9
+ jobs:
10
+ comment-trigger:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Check out repository
14
+ uses: actions/checkout@v3
15
+ - name: Run command handlers
16
+ uses: PrismarineJS/prismarine-repo-actions@master
17
+ with:
18
+ # NOTE: You must specify a Personal Access Token (PAT) with repo access here. While you can use the default GITHUB_TOKEN, actions taken with it will not trigger other actions, so if you have a CI workflow, commits created by this action will not trigger it.
19
+ token: ${{ secrets.PAT_PASSWORD }}
20
+ # See `Options` section below for more info on these options
21
+ install-command: npm install
22
+ /fixlint.fix-command: npm run fix
@@ -13,13 +13,20 @@ jobs:
13
13
  - name: Set up Node.js
14
14
  uses: actions/setup-node@master
15
15
  with:
16
- node-version: 10.0.0
17
- - name: Publish if version has been updated
18
- uses: pascalgn/npm-publish-action@4f4bf159e299f65d21cd1cbd96fc5d53228036df
19
- with: # All of theses inputs are optional
20
- tag_name: "%s"
21
- tag_message: "%s"
22
- commit_pattern: "^Release (\\S+)"
23
- env: # More info about the environment variables in the README
24
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this as is, it's automatically generated
25
- NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # You need to set this in your repo settings
16
+ node-version: 18.0.0
17
+ - id: publish
18
+ uses: JS-DevTools/npm-publish@v1
19
+ with:
20
+ token: ${{ secrets.NPM_AUTH_TOKEN }}
21
+ - name: Create Release
22
+ if: steps.publish.outputs.type != 'none'
23
+ id: create_release
24
+ uses: actions/create-release@v1
25
+ env:
26
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27
+ with:
28
+ tag_name: ${{ steps.publish.outputs.version }}
29
+ release_name: Release ${{ steps.publish.outputs.version }}
30
+ body: ${{ steps.publish.outputs.version }}
31
+ draft: false
32
+ prerelease: false
package/README.md CHANGED
@@ -81,12 +81,24 @@ get from collecting the orb.
81
81
 
82
82
  #### entity.equipment[5]
83
83
 
84
+ Version dependent.
85
+
86
+ 1.8 Layout:
87
+
84
88
  * `0` - held item
85
89
  * `1` - shoes
86
90
  * `2` - legging
87
91
  * `3` - torso
88
92
  * `4` - head
89
-
93
+
94
+ 1.9 and later:
95
+
96
+ * `0` - held item
97
+ * `1` - off-hand
98
+ * `2` - shoes
99
+ * `3` - legging
100
+ * `4` - torso
101
+ * `5` - head
90
102
 
91
103
  #### entity.heldItem
92
104
 
@@ -114,6 +126,10 @@ The health of the player, default: 20
114
126
 
115
127
  The food of the player, default: 20
116
128
 
129
+ #### entity.elytraFlying
130
+
131
+ Whether or not the entity is elytra flying.
132
+
117
133
  #### entity.player
118
134
 
119
135
  The player
@@ -128,6 +144,20 @@ returns a `prismarine-item` Item object for the dropped item, if this is a dropp
128
144
 
129
145
  ## History
130
146
 
147
+ ### 2.3.0
148
+ * [Add default elytra flying value (#69)](https://github.com/PrismarineJS/prismarine-entity/commit/f124abd47b42a908a676b91b0fcb55b1fd1a77b9) (thanks @lkwilson)
149
+ * [Fix equipment documentation for other versions (#67)](https://github.com/PrismarineJS/prismarine-entity/commit/b2f756de52fa7ceb2675fe9c2f950fa7398bc425) (thanks @IceTank)
150
+ * [Add command gh workflow allowing to use release command in comments (#66)](https://github.com/PrismarineJS/prismarine-entity/commit/4dffa63e3dd45b8f3a42575a2f6f3c2fa47d1d50) (thanks @rom1504)
151
+ * [Update to node 18.0.0 (#65)](https://github.com/PrismarineJS/prismarine-entity/commit/7fe14b95f82089b27e20f12a14f709bc8bd5c206) (thanks @rom1504)
152
+ * [Bump @types/node from 18.16.13 to 20.2.1 (#64)](https://github.com/PrismarineJS/prismarine-entity/commit/887737f531d89b25e045c4f0db4ec66497eba9f8) (thanks @dependabot[bot])
153
+ * [Add missing type (#55)](https://github.com/PrismarineJS/prismarine-entity/commit/87a94dbaf698497f56968efbb396c3692431ae6f) (thanks @sefirosweb)
154
+ * [deprecate objectType and mobType (#53)](https://github.com/PrismarineJS/prismarine-entity/commit/e3aadc7e51dccc645d81825aa0bd40b3be88cb05) (thanks @Epirito)
155
+ * [Update package.json (#52)](https://github.com/PrismarineJS/prismarine-entity/commit/1156c9b9ae76b3e82ea57348c0f4e0cbdcb6216a) (thanks @Epirito)
156
+
157
+ ### 2.2.0
158
+
159
+ * mcData to registry refactoring (step towards #2450)
160
+
131
161
  ### 2.1.1
132
162
 
133
163
  * Update mcdata
package/index.d.ts CHANGED
@@ -41,6 +41,7 @@ declare module 'prismarine-entity' {
41
41
  health?: number;
42
42
  food?: number;
43
43
  foodSaturation?: number;
44
+ elytraFlying?: boolean
44
45
  player?: object;
45
46
  effects: Effect[];
46
47
  setEquipment(index: number, item: Item): void;
@@ -48,5 +49,5 @@ declare module 'prismarine-entity' {
48
49
  getDroppedItem(): Item | null;
49
50
  }
50
51
 
51
- export type EntityType = 'player' | 'mob' | 'object' | 'global' | 'orb' | 'other';
52
+ export type EntityType = 'player' | 'mob' | 'object' | 'global' | 'orb' | 'projectile'| 'hostile' | 'other';
52
53
  }
package/index.js CHANGED
@@ -1,10 +1,10 @@
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()
@@ -24,6 +24,26 @@ module.exports = (version) => {
24
24
  this.metadata = []
25
25
  }
26
26
 
27
+ get mobType () {
28
+ printMobTypeWarning()
29
+ return this.displayName
30
+ }
31
+
32
+ set mobType (name) {
33
+ printMobTypeWarning()
34
+ this.displayName = name
35
+ }
36
+
37
+ get objectType () {
38
+ printObjectTypeWarning()
39
+ return this.displayName
40
+ }
41
+
42
+ set objectType (name) {
43
+ printObjectTypeWarning()
44
+ this.displayName = name
45
+ }
46
+
27
47
  setEquipment (index, item) {
28
48
  this.equipment[index] = item
29
49
  this.heldItem = this.equipment[0]
@@ -41,9 +61,15 @@ module.exports = (version) => {
41
61
  if (this.name !== 'item' && this.name !== 'Item' && this.name !== 'item_stack') {
42
62
  return null // not a dropped item
43
63
  }
44
- return Item.fromNotch(this.metadata[mcData.supportFeature('metadataIxOfItem')])
64
+ return Item.fromNotch(this.metadata[registry.supportFeature('metadataIxOfItem')])
45
65
  }
46
66
  }
47
67
 
48
68
  return Entity
49
69
  }
70
+ function printMobTypeWarning () {
71
+ console.log('Warning: entity.mobType is deprecated. Use entity.displayName instead')
72
+ }
73
+ function printObjectTypeWarning () {
74
+ console.log('Warning: entity.objectType is deprecated. Use entity.displayName instead')
75
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prismarine-entity",
3
- "version": "2.1.1",
3
+ "version": "2.3.0",
4
4
  "description": "Represent a minecraft entity",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -13,9 +13,9 @@
13
13
  "url": "https://github.com/PrismarineJS/prismarine-entity.git"
14
14
  },
15
15
  "dependencies": {
16
- "minecraft-data": "^3.0.0",
17
16
  "prismarine-chat": "^1.4.1",
18
17
  "prismarine-item": "^1.11.2",
18
+ "prismarine-registry": "^1.4.0",
19
19
  "vec3": "^0.1.4"
20
20
  },
21
21
  "keywords": [
@@ -29,8 +29,8 @@
29
29
  "url": "https://github.com/PrismarineJS/prismarine-entity/issues"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/node": "^17.0.4",
32
+ "@types/node": "^20.2.1",
33
33
  "prismarine-entity": "file:.",
34
- "standard": "^16.0.1"
34
+ "standard": "^17.0.0"
35
35
  }
36
36
  }