@serenityjs/protocol 0.4.3-beta-20240820153244 → 0.4.3-beta-20240820174829

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.
package/dist/index.d.ts CHANGED
@@ -2327,6 +2327,17 @@ declare class BlockCoordinates extends DataType {
2327
2327
  constructor(x: number, y: number, z: number);
2328
2328
  static read(stream: BinaryStream): BlockCoordinates;
2329
2329
  static write(stream: BinaryStream, value: BlockCoordinates): void;
2330
+ /**
2331
+ * Converts a Vector3f to a BlockCoordinates
2332
+ * @param vector - The Vector3f to convert
2333
+ * @returns The converted BlockCoordinates
2334
+ */
2335
+ static fromVector3f(vector: Vector3f): BlockCoordinates;
2336
+ /**
2337
+ * Converts the BlockCoordinates to a Vector3f
2338
+ * @returns The converted Vector3f
2339
+ */
2340
+ static toVector3f(coordinates: BlockCoordinates): Vector3f;
2330
2341
  }
2331
2342
 
2332
2343
  declare class GameRules extends DataType {
package/dist/index.js CHANGED
@@ -3111,15 +3111,36 @@ var BlockCoordinates = class _BlockCoordinates extends import_raknet10.DataType
3111
3111
  }
3112
3112
  static read(stream) {
3113
3113
  const x = stream.readZigZag();
3114
- const y = stream.readVarInt();
3114
+ let y = stream.readVarInt();
3115
3115
  const z = stream.readZigZag();
3116
+ y = 4294967295 - 64 >= y ? y : y - 4294967296;
3116
3117
  return new _BlockCoordinates(x, y, z);
3117
3118
  }
3118
3119
  static write(stream, value) {
3120
+ const y = value.y < 0 ? 4294967296 + value.y : value.y;
3119
3121
  stream.writeZigZag(value.x);
3120
- stream.writeVarInt(value.y);
3122
+ stream.writeVarInt(y);
3121
3123
  stream.writeZigZag(value.z);
3122
3124
  }
3125
+ /**
3126
+ * Converts a Vector3f to a BlockCoordinates
3127
+ * @param vector - The Vector3f to convert
3128
+ * @returns The converted BlockCoordinates
3129
+ */
3130
+ static fromVector3f(vector) {
3131
+ return new _BlockCoordinates(
3132
+ Math.floor(vector.x),
3133
+ Math.floor(vector.y),
3134
+ Math.floor(vector.z)
3135
+ );
3136
+ }
3137
+ /**
3138
+ * Converts the BlockCoordinates to a Vector3f
3139
+ * @returns The converted Vector3f
3140
+ */
3141
+ static toVector3f(coordinates) {
3142
+ return new Vector3f(coordinates.x, coordinates.y, coordinates.z);
3143
+ }
3123
3144
  };
3124
3145
 
3125
3146
  // src/proto/types/game-rules.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serenityjs/protocol",
3
- "version": "0.4.3-beta-20240820153244",
3
+ "version": "0.4.3-beta-20240820174829",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "repository": "https://github.com/SerenityJS/serenity",
@@ -18,9 +18,9 @@
18
18
  "preset": "@serenityjs/jest-presets/jest/node"
19
19
  },
20
20
  "devDependencies": {
21
- "@serenityjs/eslint-config": "0.4.3-beta-20240820153244",
22
- "@serenityjs/jest-presets": "0.4.3-beta-20240820153244",
23
- "@serenityjs/typescript-config": "0.4.3-beta-20240820153244",
21
+ "@serenityjs/eslint-config": "0.4.3-beta-20240820174829",
22
+ "@serenityjs/jest-presets": "0.4.3-beta-20240820174829",
23
+ "@serenityjs/typescript-config": "0.4.3-beta-20240820174829",
24
24
  "@types/jest": "^29.5.12",
25
25
  "@types/node": "^20.11.24",
26
26
  "jest": "^29.7.0",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@serenityjs/binarystream": "^2.6.6",
32
- "@serenityjs/nbt": "0.4.3-beta-20240820153244",
33
- "@serenityjs/raknet": "0.4.3-beta-20240820153244"
32
+ "@serenityjs/nbt": "0.4.3-beta-20240820174829",
33
+ "@serenityjs/raknet": "0.4.3-beta-20240820174829"
34
34
  }
35
35
  }