Got more things functional
This commit is contained in:
parent
a1141cd2b8
commit
fc0c1c7e7a
23 changed files with 1080 additions and 876 deletions
|
@ -1,4 +1,6 @@
|
|||
import 'package:libac_flutter/utils/uuid/NbtUUID.dart';
|
||||
import 'package:libac_flutter/nbt/impl/CompoundTag.dart';
|
||||
import 'package:libac_flutter/nbt/impl/IntTag.dart';
|
||||
import 'package:libac_flutter/nbt/impl/StringTag.dart';
|
||||
import 'package:libac_flutter/utils/uuid/UUID.dart';
|
||||
|
||||
class Mod {
|
||||
|
@ -8,10 +10,10 @@ class Mod {
|
|||
String mod_hash = "";
|
||||
|
||||
bool newMod = false;
|
||||
NbtUUID _id = NbtUUID.ZERO;
|
||||
UUID _id = UUID.ZERO;
|
||||
String mod_instance_id() {
|
||||
if (_id.toString() == NbtUUID.ZERO) {
|
||||
_id = NbtUUID.fromUUID(UUID.generate(4));
|
||||
if (_id.toString() == UUID.ZERO.toString()) {
|
||||
_id = UUID.generate(4);
|
||||
}
|
||||
|
||||
return _id.toString();
|
||||
|
@ -23,4 +25,24 @@ class Mod {
|
|||
this.newMod = false,
|
||||
this.mod_pak = "Not Initialized",
|
||||
this.mod_hash = ""});
|
||||
|
||||
CompoundTag serialize() {
|
||||
CompoundTag tag = CompoundTag();
|
||||
tag.put("name", StringTag.valueOf(mod_name));
|
||||
tag.put("id", IntTag.valueOf(mod_id));
|
||||
tag.put("pak", StringTag.valueOf(mod_pak));
|
||||
tag.put("hash", StringTag.valueOf(mod_hash));
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
static Mod deserialize(CompoundTag tag) {
|
||||
CompoundTag ct = tag as CompoundTag;
|
||||
|
||||
return Mod(
|
||||
mod_name: ct.get("name")!.asString(),
|
||||
mod_id: ct.get("id")!.asInt(),
|
||||
mod_pak: ct.get("pak")!.asString(),
|
||||
mod_hash: ct.get("hash")!.asString());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue