prismarine-physics 1.5.2 → 1.7.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: [14.x]
16
+ node-version: [18.x]
17
17
 
18
18
  steps:
19
19
  - uses: actions/checkout@v2
@@ -13,7 +13,7 @@ jobs:
13
13
  - name: Set up Node.js
14
14
  uses: actions/setup-node@master
15
15
  with:
16
- node-version: 14.0.0
16
+ node-version: 18.0.0
17
17
  - id: publish
18
18
  uses: JS-DevTools/npm-publish@v1
19
19
  with:
package/HISTORY.md CHANGED
@@ -1,5 +1,15 @@
1
1
  ## History
2
2
 
3
+ ### 1.7.0
4
+
5
+ * 1.20
6
+ * add pitch
7
+
8
+ ### 1.6.0
9
+
10
+ * Fix left and right (@Kashalls)
11
+ * Fix 1.19 Water Physics (@ATXLtheAxolotl)
12
+
3
13
  ### 1.5.2
4
14
 
5
15
  * Fix publish.yml
package/README.md CHANGED
@@ -81,6 +81,7 @@ Read / Write properties:
81
81
 
82
82
  Read only properties:
83
83
  - yaw : (float) the yaw angle, in radians, of the player entity
84
+ - pitch: (float) the pitch angle, in radians, of the player entity
84
85
  - control : (object) control states vector with properties:
85
86
  - forward
86
87
  - back
package/examples/basic.js CHANGED
@@ -13,7 +13,7 @@ const fakeWorld = {
13
13
  }
14
14
  }
15
15
 
16
- function fakePlayer (pos) {
16
+ function fakePlayer (pos, baseVersion) {
17
17
  return {
18
18
  entity: {
19
19
  position: pos,
@@ -24,10 +24,15 @@ function fakePlayer (pos) {
24
24
  isInWeb: false,
25
25
  isCollidedHorizontally: false,
26
26
  isCollidedVertically: false,
27
- yaw: 0
27
+ yaw: 0,
28
+ effects: []
29
+ },
30
+ inventory: {
31
+ slots: []
28
32
  },
29
33
  jumpTicks: 0,
30
- jumpQueued: false
34
+ jumpQueued: false,
35
+ version: baseVersion
31
36
  }
32
37
  }
33
38
 
@@ -41,7 +46,7 @@ const controls = {
41
46
  sprint: false,
42
47
  sneak: false
43
48
  }
44
- const player = fakePlayer(new Vec3(0, 80, 0))
49
+ const player = fakePlayer(new Vec3(0, 80, 0), mcData.version.version)
45
50
  const playerState = new PlayerState(player, controls)
46
51
 
47
52
  while (!player.entity.onGround) {
package/index.js CHANGED
@@ -89,6 +89,8 @@ function Physics (mcData, world) {
89
89
  } else if (supportFeature('proportionalLiquidGravity')) {
90
90
  physics.waterGravity = physics.gravity / 16
91
91
  physics.lavaGravity = physics.gravity / 4
92
+ } else {
93
+ throw new Error('No liquid gravity settings, have you made sure the liquid gravity features are up to date?')
92
94
  }
93
95
 
94
96
  function getPlayerBB (pos) {
@@ -354,8 +356,8 @@ function Physics (mcData, world) {
354
356
  const cos = Math.cos(yaw)
355
357
 
356
358
  const vel = entity.vel
357
- vel.x += strafe * cos - forward * sin
358
- vel.z += forward * cos + strafe * sin
359
+ vel.x -= strafe * cos + forward * sin
360
+ vel.z += forward * cos - strafe * sin
359
361
  }
360
362
 
361
363
  function isOnLadder (world, pos) {
@@ -687,6 +689,7 @@ class PlayerState {
687
689
  // Input only (not modified)
688
690
  this.attributes = bot.entity.attributes
689
691
  this.yaw = bot.entity.yaw
692
+ this.pitch = bot.entity.pitch
690
693
  this.control = control
691
694
 
692
695
  // effects
package/lib/features.json CHANGED
@@ -7,7 +7,7 @@
7
7
  {
8
8
  "name": "proportionalLiquidGravity",
9
9
  "description": "Liquid gravity is a proportion of normal gravity",
10
- "versions": ["1.13", "1.14", "1.15", "1.16", "1.17", "1.18"]
10
+ "versions": ["1.13", "1.14", "1.15", "1.16", "1.17", "1.18", "1.19", "1.20"]
11
11
  },
12
12
  {
13
13
  "name": "velocityBlocksOnCollision",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prismarine-physics",
3
- "version": "1.5.2",
3
+ "version": "1.7.0",
4
4
  "description": "Provide the physics engine for minecraft entities",
5
5
  "main": "index.js",
6
6
  "directories": {