@nxg-org/mineflayer-physics-util 1.4.5 → 1.4.7

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.
@@ -673,7 +673,7 @@ class EntityPhysics {
673
673
  }
674
674
  entity.state.jumpQueued = false;
675
675
  strafe =
676
- (entity.state.controlState.right - entity.state.controlState.left) * 0.98;
676
+ (entity.state.controlState.left - entity.state.controlState.right) * 0.98;
677
677
  forward =
678
678
  (entity.state.controlState.forward - entity.state.controlState.back) * 0.98;
679
679
  if (entity.state.controlState.sneak) {
@@ -75,7 +75,7 @@ export declare class EntityState implements EntityStateBuilder {
75
75
  */
76
76
  static CREATE_RAW(ctx: IPhysics, raw: EntityStateBuilder): EntityState;
77
77
  updateFromBot(bot: Bot): EntityState;
78
- updateFromEntity(entity: Entity): this;
78
+ updateFromEntity(entity: Entity, all?: boolean): this;
79
79
  updateFromRaw(other: EntityStateBuilder): this;
80
80
  applyToBot(bot: Bot): this;
81
81
  /**
@@ -70,28 +70,31 @@ class EntityState {
70
70
  return new EntityState(ctx, raw.height, raw.halfWidth, raw.position, raw.velocity, raw.onGround, raw.controlState, raw.yaw, raw.pitch);
71
71
  }
72
72
  updateFromBot(bot) {
73
- this.updateFromEntity(bot.entity);
73
+ this.updateFromEntity(bot.entity, true);
74
74
  this.controlState = playerControls_1.ControlStateHandler.COPY_BOT(bot);
75
75
  this.jumpTicks = bot.jumpTicks;
76
76
  this.jumpQueued = bot.jumpQueued;
77
77
  return this;
78
78
  }
79
- updateFromEntity(entity) {
79
+ updateFromEntity(entity, all = false) {
80
80
  var _a, _b;
81
+ if (all) {
82
+ // most mobs don't have this defined, so ignore it (only self does).
83
+ this.velocity = entity.velocity.clone();
84
+ this.onGround = entity.onGround;
85
+ this.isInWater = entity.isInWater;
86
+ this.isInLava = entity.isInLava;
87
+ this.isInWeb = entity.isInWeb;
88
+ this.isCollidedHorizontally = entity.isCollidedHorizontally;
89
+ this.isCollidedVertically = entity.isCollidedVertically;
90
+ this.sneakCollision = false; //TODO
91
+ this.attributes || (this.attributes = entity.attributes);
92
+ }
81
93
  this.position = entity.position.clone();
82
- this.velocity = entity.velocity.clone();
83
- this.onGround = entity.onGround;
84
- this.isInWater = entity.isInWater;
85
- this.isInLava = entity.isInLava;
86
- this.isInWeb = entity.isInWeb;
87
- this.isCollidedHorizontally = entity.isCollidedHorizontally;
88
- this.isCollidedVertically = entity.isCollidedVertically;
89
- this.sneakCollision = false; //TODO
90
94
  //not sure what to do here, ngl.
91
95
  this.jumpTicks || (this.jumpTicks = 0);
92
96
  this.jumpQueued || (this.jumpQueued = false);
93
97
  // Input only (not modified)
94
- this.attributes = entity.attributes;
95
98
  this.yaw = entity.yaw;
96
99
  this.pitch = entity.pitch;
97
100
  this.controlState || (this.controlState = playerControls_1.ControlStateHandler.DEFAULT());
@@ -117,7 +120,7 @@ class EntityState {
117
120
  else {
118
121
  this.depthStrider = 0;
119
122
  }
120
- this.pose = poses_1.PlayerPoses.STANDING;
123
+ this.pose || (this.pose = poses_1.PlayerPoses.STANDING);
121
124
  return this;
122
125
  }
123
126
  updateFromRaw(other) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxg-org/mineflayer-physics-util",
3
- "version": "1.4.5",
3
+ "version": "1.4.7",
4
4
  "description": "Provides functionality for more accurate entity and projectile tracking.",
5
5
  "keywords": [
6
6
  "mineflayer",