Get wrapper working

This commit is contained in:
zontreck 2024-06-04 21:51:53 -07:00
parent 0ae098318a
commit 26434a9123
19 changed files with 211 additions and 255 deletions

View file

@ -1,3 +1,4 @@
import 'package:libac_dart/nbt/NbtUtils.dart';
import 'package:libac_dart/nbt/impl/CompoundTag.dart';
import 'package:libac_dart/nbt/impl/LongTag.dart';
import 'package:libac_dart/nbt/impl/StringTag.dart';
@ -8,6 +9,7 @@ class Mod {
int mod_id = 0;
String mod_pak = "";
String mod_hash = "";
bool enabled = true;
bool newMod = false;
UUID _id = UUID.ZERO;
@ -24,7 +26,8 @@ class Mod {
this.mod_id = 0,
this.newMod = false,
this.mod_pak = "Not Initialized",
this.mod_hash = ""});
this.mod_hash = "",
this.enabled = true});
CompoundTag serialize() {
CompoundTag tag = CompoundTag();
@ -32,6 +35,7 @@ class Mod {
tag.put("id", LongTag.valueOf(mod_id));
tag.put("pak", StringTag.valueOf(mod_pak));
tag.put("hash", StringTag.valueOf(mod_hash));
NbtUtils.writeBoolean(tag, "enabled", enabled);
return tag;
}
@ -43,6 +47,7 @@ class Mod {
mod_name: ct.get("name")!.asString(),
mod_id: ct.get("id")!.asLong(),
mod_pak: ct.get("pak")!.asString(),
mod_hash: ct.get("hash")!.asString());
mod_hash: ct.get("hash")!.asString(),
enabled: NbtUtils.readBoolean(tag, "enabled"));
}
}