@nxg-org/mineflayer-physics-util 1.3.4 → 1.3.6

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.
@@ -70,27 +70,10 @@ 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
- var _a, _b;
73
+ this.updateFromEntity(bot.entity);
74
74
  this.controlState = playerControls_1.ControlStateHandler.COPY_BOT(bot);
75
- this.onGround = this.onGround;
76
- this.isUsingItem = (0, physicsUtils_1.isEntityUsingItem)(bot.entity);
77
- this.attributes = bot.entity.attributes;
78
- this.effects = bot.entity.effects;
79
- this.jumpBoost = this.ctx.getEffectLevel(physicsUtils_1.CheapEffects.JUMP_BOOST, this.effects);
80
- this.speed = this.ctx.getEffectLevel(physicsUtils_1.CheapEffects.SPEED, this.effects);
81
- this.slowness = this.ctx.getEffectLevel(physicsUtils_1.CheapEffects.SLOWNESS, this.effects);
82
- this.dolphinsGrace = this.ctx.getEffectLevel(physicsUtils_1.CheapEffects.DOLPHINS_GRACE, this.effects);
83
- this.slowFalling = this.ctx.getEffectLevel(physicsUtils_1.CheapEffects.SLOW_FALLING, this.effects);
84
- this.levitation = this.ctx.getEffectLevel(physicsUtils_1.CheapEffects.LEVITATION, this.effects);
85
- const boots = bot.entity.equipment[5];
86
- if (boots && boots.nbt) {
87
- const simplifiedNbt = prismarine_nbt_1.default.simplify(boots.nbt);
88
- const enchantments = (_b = (_a = simplifiedNbt.Enchantments) !== null && _a !== void 0 ? _a : simplifiedNbt.ench) !== null && _b !== void 0 ? _b : [];
89
- this.depthStrider = this.ctx.getEnchantmentLevel(physicsUtils_1.CheapEnchantments.DEPTH_STRIDER, enchantments);
90
- }
91
- else {
92
- this.depthStrider = 0;
93
- }
75
+ this.jumpTicks = bot.jumpTicks;
76
+ this.jumpQueued = bot.jumpQueued;
94
77
  return this;
95
78
  }
96
79
  updateFromEntity(entity) {
@@ -12,6 +12,7 @@ export declare abstract class BaseSimulator {
12
12
  constructor(ctx: IPhysics);
13
13
  predictGenerator(simCtx: EPhysicsCtx, world: any, ticks?: number, controls?: ControlStateHandler): Generator<EntityState, EPhysicsCtx, unknown>;
14
14
  predictForward(target: Entity, world: any, ticks?: number, controls?: ControlStateHandler): EntityState;
15
+ predictForwardRaw(simCtx: EPhysicsCtx, world: any, ticks?: number, controls?: ControlStateHandler): EntityState;
15
16
  simulateUntil(goal: SimulationGoal, onGoalReach: OnGoalReachFunction, controller: Controller, simCtx: EPhysicsCtx, world: any, ticks?: number): EntityState;
16
17
  static getReached(...path: Vec3[]): SimulationGoal;
17
18
  static getCleanupPosition(...path: Vec3[]): OnGoalReachFunction;
@@ -21,6 +21,13 @@ class BaseSimulator {
21
21
  }
22
22
  return simCtx.state;
23
23
  }
24
+ predictForwardRaw(simCtx, world, ticks = 1, controls) {
25
+ simCtx.state.controlState = controls !== null && controls !== void 0 ? controls : simCtx.state.controlState;
26
+ for (let current = 0; current < ticks; current++) {
27
+ this.ctx.simulate(simCtx, world);
28
+ }
29
+ return simCtx.state;
30
+ }
24
31
  simulateUntil(goal, onGoalReach, controller, simCtx, world, ticks = 1) {
25
32
  for (let i = 0; i < ticks; i++) {
26
33
  if (goal(simCtx.state, i)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxg-org/mineflayer-physics-util",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "Provides functionality for more accurate entity and projectile tracking.",
5
5
  "keywords": [
6
6
  "mineflayer",