@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
|
-
|
|
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
|
package/package.json
CHANGED