update WorldConverter (WIP)

This commit is contained in:
MihailRis
2024-09-02 23:24:59 +03:00
parent 3f826a88d3
commit 728795f0f3
12 changed files with 299 additions and 97 deletions
+9
View File
@@ -81,6 +81,15 @@ std::unique_ptr<dynamic::Map> Inventory::serialize() const {
return map;
}
void Inventory::convert(const ContentReport* report) {
for (auto& slot : slots) {
itemid_t id = slot.getItemId();
itemid_t replacement = report->items.getId(id);
slot.set(ItemStack(replacement, slot.getCount()));
}
}
// TODO: remove
void Inventory::convert(dynamic::Map* data, const ContentReport* report) {
auto slotsarr = data->list("slots");
for (size_t i = 0; i < slotsarr->size(); i++) {