@serenityjs/nbt 0.3.4 → 0.3.5-beta-20240613224119

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
@@ -204,12 +204,24 @@ declare class CompoundTag<T = Record<string, NBTTag<unknown>>> extends NBTTag<T>
204
204
  * @returns The tag that was found.
205
205
  */
206
206
  hasTag(name: string): boolean;
207
+ /**
208
+ * Sets a tag in the compound tag.
209
+ *
210
+ * @param name The name of the tag to set.
211
+ * @param tag The tag to set.
212
+ */
213
+ setTag(name: string, tag: NBTTag<T>): this;
207
214
  /**
208
215
  * Returns all the tags in the compound tag.
209
216
  *
210
217
  * @returns All the tags in the compound tag.
211
218
  */
212
219
  getTags(): Array<NBTTag<T>>;
220
+ /**
221
+ * Returns all the names of the tags in the compound tag.
222
+ * @returns All the names of the tags in the compound tag.
223
+ */
224
+ clear(): this;
213
225
  valueOf<K = unknown>(snbt?: boolean): K | string;
214
226
  /**
215
227
  * Reads a compound tag from the stream.
package/dist/index.js CHANGED
@@ -389,6 +389,16 @@ var CompoundTag = class _CompoundTag extends NBTTag {
389
389
  hasTag(name) {
390
390
  return name in this.value;
391
391
  }
392
+ /**
393
+ * Sets a tag in the compound tag.
394
+ *
395
+ * @param name The name of the tag to set.
396
+ * @param tag The tag to set.
397
+ */
398
+ setTag(name, tag) {
399
+ this.value[name] = tag;
400
+ return this;
401
+ }
392
402
  /**
393
403
  * Returns all the tags in the compound tag.
394
404
  *
@@ -397,6 +407,16 @@ var CompoundTag = class _CompoundTag extends NBTTag {
397
407
  getTags() {
398
408
  return Object.values(this.value);
399
409
  }
410
+ /**
411
+ * Returns all the names of the tags in the compound tag.
412
+ * @returns All the names of the tags in the compound tag.
413
+ */
414
+ clear() {
415
+ for (const key in this.value) {
416
+ delete this.value[key];
417
+ }
418
+ return this;
419
+ }
400
420
  valueOf(snbt) {
401
421
  if (snbt) {
402
422
  const value = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serenityjs/nbt",
3
- "version": "0.3.4",
3
+ "version": "0.3.5-beta-20240613224119",
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": "*",
22
- "@serenityjs/jest-presets": "*",
23
- "@serenityjs/typescript-config": "*",
21
+ "@serenityjs/eslint-config": "0.3.5-beta-20240613224119",
22
+ "@serenityjs/jest-presets": "0.3.5-beta-20240613224119",
23
+ "@serenityjs/typescript-config": "0.3.5-beta-20240613224119",
24
24
  "@types/jest": "^29.5.12",
25
25
  "@types/node": "^20.11.24",
26
26
  "jest": "^29.7.0",