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.
- package/.github/workflows/ci.yml +1 -1
- package/.github/workflows/publish.yml +1 -1
- package/HISTORY.md +10 -0
- package/README.md +1 -0
- package/examples/basic.js +9 -4
- package/index.js +5 -2
- package/lib/features.json +1 -1
- package/package.json +1 -1
package/.github/workflows/ci.yml
CHANGED
package/HISTORY.md
CHANGED
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
|
|
358
|
-
vel.z += forward * cos
|
|
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",
|