Try to update Milo for 1.19

Removes Milo trying to access damage on items (`nil` because of The
Flattening). We might also need to reimplement showing durability in the
item's display name - I got a little too carried away with removing
mentions of "damage". Also renames nbtHash to nbt to be consistent with
new CC:T naming. I tried not to touch anything related to MiloRemote for
now, and there are probably still many bugs remaining that need to be
ironed out. Most of the basic functionality works now, though.
This commit is contained in:
Kan18
2022-12-24 15:33:01 +04:00
parent 2461d060e0
commit 2f67fb2ef8
16 changed files with 101 additions and 100 deletions

View File

@@ -21,7 +21,7 @@ function ImportTask:cycle(context)
for _, entry in pairs(node.imports) do
local function itemMatchesFilter(item)
if not entry.ignoreDamage and not entry.ignoreNbtHash then
if not entry.ignoreNbt then
local key = itemDB:makeKey(item)
return entry.filter[key]
end
@@ -29,8 +29,7 @@ function ImportTask:cycle(context)
for key in pairs(entry.filter) do
local v = itemDB:splitKey(key)
if item.name == v.name and
(entry.ignoreDamage or item.damage == v.damage) and
(entry.ignoreNbtHash or item.nbtHash == v.nbtHash) then
(entry.ignoreNbt or item.nbt == v.nbt) then
return true
end
end
@@ -52,7 +51,7 @@ function ImportTask:cycle(context)
local function importSlot(slotNo)
local item = itemDB:get(list[slotNo], function()
return node.adapter.getItemMeta(slotNo)
return node.adapter.getItemDetail(slotNo)
end)
if item and matchesFilter(item) then
if context.storage:import(node, slotNo, item.count, item) ~= item.count then