From 9ed9f0d6e56b41b8b894e6a4c153e4993183d48b Mon Sep 17 00:00:00 2001 From: Stevertus Date: Thu, 4 Jan 2024 22:50:44 +0100 Subject: [PATCH] fix entity tag bug + project versions --- lib/src/basic/types/entity.dart | 9 +++++---- lib/src/build/project.dart | 8 +++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/src/basic/types/entity.dart b/lib/src/basic/types/entity.dart index b04a544..4357f0f 100644 --- a/lib/src/basic/types/entity.dart +++ b/lib/src/basic/types/entity.dart @@ -1133,10 +1133,11 @@ class Entity extends GsonValue implements EntityClass { ret += '['; for (var key in arguments.keys) { if (arguments[key] is List) { - arguments[key].forEach((item) { - ret += _addArg(item, key); - if (item != arguments[key].last) ret += ','; - }); + final list = arguments[key] as List; + if (list.isEmpty) continue; + + ret += list.map((item) => _addArg(item, key)).join(','); + if (key != arguments.keys.last) ret += ','; } else { ret += _addArg(arguments[key], key); diff --git a/lib/src/build/project.dart b/lib/src/build/project.dart index c900400..35131af 100644 --- a/lib/src/build/project.dart +++ b/lib/src/build/project.dart @@ -6,6 +6,7 @@ class Project { final String name; final String description; final double version; + final int? packFormat; Widget generate; /// The project is a special Widget which is just defined once. @@ -25,8 +26,9 @@ class Project { Project({ required this.name, required this.generate, - this.version = 16, + this.version = 20.4, this.target = './', + this.packFormat, this.description = 'This is a datapack generated with objd by Stevertus', }); @@ -48,6 +50,10 @@ class Project { }; int getPackFormat() { + if (packFormat != null) return packFormat!; + if (version >= 20.3) return 26; + if (version >= 20.2) return 18; + if (version >= 20) return 15; if (version >= 19.4) return 12; if (version > 19.3) return 11; if (version >= 19) return 10;