@nxg-org/mineflayer-tracker
Version:
Provides functionality for more accurate entity and projectile tracking.
67 lines (66 loc) • 2.33 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PhysicsSettings = void 0;
class PhysicsSettings {
constructor(ctx) {
this.gravity = 0.08;
this.airdrag = Math.fround(1 - 0.02);
this.yawSpeed = 3.0;
this.pitchSpeed = 3.0;
this.playerSpeed = 0.1;
this.sprintSpeed = 0.3;
this.sneakSpeed = 0.3;
this.usingItemSpeed = 0.2;
this.stepHeight = 0.6; // how much height can the bot step on without jump
this.negligeableVelocity = 0.003; // actually 0.005 for 1.8; but seems fine
this.soulsandSpeed = 0.4;
this.honeyblockSpeed = 0.4;
this.honeyblockJumpSpeed = 0.4;
this.ladderMaxSpeed = 0.15;
this.ladderClimbSpeed = 0.2;
this.playerHalfWidth = 0.3;
this.playerHeight = 1.8;
this.waterInertia = 0.8;
this.lavaInertia = 0.5;
this.liquidAcceleration = 0.02;
this.airborneInertia = 0.91;
this.airborneAcceleration = 0.02;
this.defaultSlipperiness = 0.6;
this.outOfLiquidImpulse = 0.3;
this.autojumpCooldown = 10; // ticks (0.5s)
this.bubbleColumnSurfaceDrag = {
down: 0.03,
maxDown: -0.9,
up: 0.1,
maxUp: 1.8,
};
this.bubbleColumnDrag = {
down: 0.03,
maxDown: -0.3,
up: 0.06,
maxUp: 0.7,
};
this.slowFalling = 0.125;
this.sprintingUUID = "662a6b8d-da3e-4c1c-8813-96ea6097278d"; // SPEED_MODIFIER_SPRINTING_UUID is from LivingEntity.java
// this.waterGravity = 0.02;
// this.lavaGravity = 0.02;
this.movementSpeedAttribute = ctx.data.attributesByName.movementSpeed.resource;
if (ctx.supportFeature("independentLiquidGravity")) {
this.waterGravity = 0.02;
this.lavaGravity = 0.02;
}
else if (ctx.supportFeature("proportionalLiquidGravity")) {
this.waterGravity = this.gravity / 16;
this.lavaGravity = this.gravity / 4;
}
else {
this.waterGravity = 0.005;
this.lavaGravity = 0.02;
}
}
// May move this later.
getHeight(obj) {
this.bubbleColumnDrag;
}
}
exports.PhysicsSettings = PhysicsSettings;