@nxg-org/mineflayer-util-plugin 1.3.9 → 1.3.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.
@@ -1,13 +1,13 @@
1
1
  import type { Bot } from "mineflayer";
2
2
  import type { Entity } from "prismarine-entity";
3
3
  import type { Vec3 } from "vec3";
4
- import { goals } from "mineflayer-pathfinder";
4
+ import { goals, Movements } from "mineflayer-pathfinder";
5
5
  export declare class MovementFunctions {
6
- bot: Bot;
6
+ private bot;
7
7
  goalArray: goals.GoalCompositeAll;
8
- lastYaw: number;
9
- lastPitch: number;
10
8
  constructor(bot: Bot);
9
+ set movements(movements: Movements);
10
+ get movements(): Movements;
11
11
  /**
12
12
  * Fuckin' mineflayer-pathfinder still doesn't have typings.
13
13
  * Pain in my goddamn ass.
@@ -38,6 +38,6 @@ export declare class MovementFunctions {
38
38
  */
39
39
  followEntityWithRespectRange(entity: Entity, followDistance: number, invertDistance?: number): boolean;
40
40
  forceLook(yaw: number, pitch: number, update?: boolean): void;
41
- forceLookAt(pos: Vec3, update?: boolean, trueForce?: boolean): void;
41
+ forceLookAt(pos: Vec3, update?: boolean): void;
42
42
  lazyTeleport(endPos: Vec3): void;
43
43
  }
@@ -1,14 +1,23 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.MovementFunctions = void 0;
4
7
  const mineflayer_pathfinder_1 = require("mineflayer-pathfinder");
8
+ const minecraft_data_1 = __importDefault(require("minecraft-data"));
5
9
  const { GoalCompositeAll, GoalInvert, GoalFollow } = mineflayer_pathfinder_1.goals;
6
10
  class MovementFunctions {
7
11
  constructor(bot) {
8
12
  this.bot = bot;
9
13
  this.goalArray = new GoalCompositeAll();
10
- this.lastYaw = 0;
11
- this.lastPitch = 0;
14
+ this.movements = new mineflayer_pathfinder_1.Movements(bot, (0, minecraft_data_1.default)(bot.version));
15
+ }
16
+ set movements(movements) {
17
+ this.bot.pathfinder.setMovements(movements);
18
+ }
19
+ get movements() {
20
+ return this.movements;
12
21
  }
13
22
  /**
14
23
  * Fuckin' mineflayer-pathfinder still doesn't have typings.
@@ -85,23 +94,21 @@ class MovementFunctions {
85
94
  }
86
95
  forceLook(yaw, pitch, update = false) {
87
96
  const notchianYawAndPitch = { yaw: this.bot.util.math.toNotchianYaw(yaw), pitch: this.bot.util.math.toNotchianPitch(pitch) };
88
- this.bot._client.write("look", Object.assign(Object.assign({}, notchianYawAndPitch), { onGround: false }));
97
+ this.bot._client.write("look", Object.assign(Object.assign({}, notchianYawAndPitch), { onGround: this.bot.entity.onGround }));
89
98
  if (update) {
90
- // this.bot.entity.yaw = yaw;
91
- // this.bot.entity.pitch = pitch
92
- this.bot.look(yaw, pitch, true);
99
+ this.bot.entity.yaw = yaw;
100
+ this.bot.entity.pitch = pitch;
101
+ // this.bot.look(yaw, pitch, true);
93
102
  }
94
103
  }
95
- forceLookAt(pos, update = false, trueForce = false) {
104
+ forceLookAt(pos, update = false) {
96
105
  const { yaw, pitch } = this.bot.util.math.pointToYawAndPitch(this.bot, pos);
97
106
  const nyp = { yaw: this.bot.util.math.toNotchianYaw(yaw), pitch: this.bot.util.math.toNotchianPitch(pitch) };
98
- if (nyp.yaw !== this.lastYaw || nyp.pitch !== this.lastPitch || trueForce) {
99
- this.bot._client.write("look", Object.assign(Object.assign({}, nyp), { onGround: false }));
100
- if (update) {
101
- // this.bot.entity.yaw = yaw;
102
- // this.bot.entity.pitch = pitch
103
- this.bot.look(yaw, pitch, true);
104
- }
107
+ this.bot._client.write("look", Object.assign(Object.assign({}, nyp), { onGround: this.bot.entity.onGround }));
108
+ if (update) {
109
+ this.bot.entity.yaw = yaw;
110
+ this.bot.entity.pitch = pitch;
111
+ // this.bot.look(yaw, pitch, true);
105
112
  }
106
113
  }
107
114
  lazyTeleport(endPos) { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxg-org/mineflayer-util-plugin",
3
- "version": "1.3.9",
3
+ "version": "1.3.10",
4
4
  "description": "mineflayer utils for NextGEN mineflayer plugins.",
5
5
  "keywords": [
6
6
  "mineflayer",