@nxg-org/mineflayer-physics-util 1.7.9 → 1.7.10

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.
@@ -212,12 +212,9 @@ class BotcraftPhysics {
212
212
  }
213
213
  }
214
214
  const playerFlag = ctx.entityType.type === "player";
215
- // if world is currently loaded at player position
216
- if (playerFlag) {
217
- // TODO: check if spectator mode
218
- }
219
215
  this.fluidPhysics(ctx, world, true);
220
216
  this.fluidPhysics(ctx, world, false);
217
+ // updateSwimming moved into AiStep.
221
218
  // separation into a new function
222
219
  // originally: https://github.com/adepierre/Botcraft/blob/6c572071b0237c27a85211a246ce10565ef4d80f/botcraft/src/Game/Physics/PhysicsManager.cpp#L325
223
220
  if (playerFlag) {
@@ -895,7 +892,18 @@ class BotcraftPhysics {
895
892
  const inertia = player.onGround ? friction * ctx.airborneInertia : ctx.airborneInertia;
896
893
  // deviation, adding additional logic for changing attribute values.
897
894
  const movementSpeedAttr = this.getMovementSpeedAttribute(ctx);
898
- const inputStrength = player.onGround ? movementSpeedAttr * (0.21600002 / (friction * friction * friction)) : 0.02;
895
+ let inputStrength;
896
+ if (player.onGround) {
897
+ inputStrength = movementSpeedAttr * (0.21600002 / (friction * friction * friction));
898
+ }
899
+ else {
900
+ inputStrength = 0.02;
901
+ // DEVIATION: taken from p-physics, fixes motion!
902
+ if (player.control.sprint) {
903
+ const airSprintFactor = ctx.airborneAccel * 0.3;
904
+ inputStrength += airSprintFactor;
905
+ }
906
+ }
899
907
  this.applyInputs(inputStrength, player);
900
908
  if (player.onClimbable) {
901
909
  // LivingEntity::handleOnClimbable
@@ -620,6 +620,7 @@ class EntityPhysics {
620
620
  else
621
621
  vel.y -= entity.gravity * gravityMultiplier;
622
622
  }
623
+ console.log(dragOrFriction);
623
624
  vel.x *= dragOrFriction;
624
625
  vel.z *= dragOrFriction;
625
626
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxg-org/mineflayer-physics-util",
3
- "version": "1.7.9",
3
+ "version": "1.7.10",
4
4
  "description": "Provides functionality for more accurate entity and projectile tracking.",
5
5
  "keywords": [
6
6
  "mineflayer",
@@ -134,7 +134,6 @@ function buildBot() {
134
134
 
135
135
  for (let i = 0; i <= Number(time); i++) {
136
136
  console.log(bot.entity.position, bot.entity.velocity, i);
137
- console.log()
138
137
  await bot.waitForTicks(1);
139
138
  }
140
139
  bot.clearControlStates();