Skip to content
This repository has been archived by the owner on Oct 30, 2022. It is now read-only.

Commit

Permalink
Replace SNBT module with built-in NBT module
Browse files Browse the repository at this point in the history
  • Loading branch information
Rjlintkh committed Apr 30, 2022
1 parent 99c74ba commit 711b878
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 516 deletions.
9 changes: 4 additions & 5 deletions src/api/nbt.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { ByteArrayTag, ByteTag, CompoundTag, DoubleTag, EndTag, FloatTag, Int64Tag, IntTag, ListTag, ShortTag, StringTag, Tag } from "bdsx/bds/nbt";
import { ByteArrayTag, ByteTag, CompoundTag, DoubleTag, EndTag, FloatTag, Int64Tag, IntTag, ListTag, NBT as _NBT, ShortTag, StringTag, Tag } from "bdsx/bds/nbt";
import { decay } from "bdsx/decay";
import { LlAPI } from "../dep/native";
import { SNBT } from "../dep/snbt";
import { logger, PrivateFields, Tag2Value, TODO } from "./api_help";

export class NBT {
static parseSNBT(snbt: string) {
const tag = SNBT.parse(snbt);
const tag = _NBT.allocate(_NBT.parse(snbt));
if (tag.getId() === Tag.Type.Compound) {
const nbt = new NbtCompound();
nbt[PrivateFields] = <CompoundTag>tag;
Expand Down Expand Up @@ -169,7 +168,7 @@ export class NbtLong {
[PrivateFields]: Int64Tag;

constructor(data: number | string) {
this[PrivateFields] = Int64Tag.allocateWith(SNBT.Utils.makeBin64fromNumbericString(data.toString()));
this[PrivateFields] = Int64Tag.allocateWithString(data+"");
}

getType() {
Expand Down Expand Up @@ -533,7 +532,7 @@ export class NbtCompound {
}

toSNBT() {
return SNBT.stringify(this[PrivateFields]);
return _NBT.stringify(this[PrivateFields]);
}

toBinaryNBT() {
Expand Down
Loading

0 comments on commit 711b878

Please sign in to comment.