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:
@@ -20,16 +20,18 @@ function infoTab:draw()
|
||||
Ansi.orange, item.displayName, Ansi.reset,
|
||||
item.name)
|
||||
|
||||
if item.nbtHash then
|
||||
value = value .. item.nbtHash .. '\n'
|
||||
if item.nbt then
|
||||
value = value .. item.nbt .. '\n'
|
||||
end
|
||||
|
||||
value = value .. string.format('\n%sCount:%s %s',
|
||||
Ansi.yellow, Ansi.reset, item.count)
|
||||
|
||||
value = value .. string.format('\n%sDamage:%s %s',
|
||||
Ansi.yellow, Ansi.reset, item.damage)
|
||||
|
||||
if item.durability then
|
||||
value = value .. string.format('\n%Durability:%s %s',
|
||||
Ansi.yellow, Ansi.reset, item.durability)
|
||||
end
|
||||
|
||||
if item.maxDamage and item.maxDamage > 0 then
|
||||
value = value .. string.format(' (max: %s)', item.maxDamage)
|
||||
end
|
||||
|
||||
@@ -29,11 +29,7 @@ local manageTab = UI.Tab {
|
||||
transform = 'number',
|
||||
},
|
||||
[4] = UI.Checkbox {
|
||||
formLabel = 'Ignore Dmg', formKey = 'ignoreDamage',
|
||||
help = 'Ignore damage of item',
|
||||
},
|
||||
[5] = UI.Checkbox {
|
||||
formLabel = 'Ignore NBT', formKey = 'ignoreNbtHash',
|
||||
formLabel = 'Ignore NBT', formKey = 'ignoreNbt',
|
||||
help = 'Ignore NBT of item',
|
||||
},
|
||||
},
|
||||
@@ -44,8 +40,6 @@ function manageTab:setItem(item)
|
||||
self.res = Util.shallowCopy(context.resources[item.key] or { })
|
||||
self.res.displayName = self.item.displayName
|
||||
self.form:setValues(self.res)
|
||||
|
||||
-- TODO: ignore damage should not be active if there is not a maxDamage value
|
||||
end
|
||||
|
||||
function manageTab:eventHandler(event)
|
||||
@@ -76,8 +70,7 @@ function manageTab:eventHandler(event)
|
||||
|
||||
local newKey = {
|
||||
name = self.item.name,
|
||||
damage = self.res.ignoreDamage and 0 or self.item.damage,
|
||||
nbtHash = not self.res.ignoreNbtHash and self.item.nbtHash or nil,
|
||||
nbt = not self.res.ignoreNbt and self.item.nbt or nil,
|
||||
}
|
||||
|
||||
context.resources[self.item.key] = nil
|
||||
|
||||
@@ -42,7 +42,7 @@ function recipeTab:setItem(item)
|
||||
})
|
||||
end
|
||||
local key = itemDB:splitKey(self.recipe.result)
|
||||
self.ignoreResultNBT.inactive = not key.nbtHash
|
||||
self.ignoreResultNBT.inactive = not key.nbt
|
||||
end
|
||||
self.grid:setValues(t)
|
||||
end
|
||||
@@ -53,7 +53,7 @@ function recipeTab:eventHandler(event)
|
||||
Milo:updateRecipe(self.recipe.result)
|
||||
|
||||
local item = itemDB:splitKey(self.recipe.result)
|
||||
item.nbtHash = nil
|
||||
item.nbt = nil
|
||||
self.recipe.result = itemDB:makeKey(item)
|
||||
|
||||
-- add updated entry
|
||||
@@ -64,13 +64,13 @@ function recipeTab:eventHandler(event)
|
||||
|
||||
elseif event.type == 'grid_focus_row' then
|
||||
local key = itemDB:splitKey(event.selected.key)
|
||||
self.ignoreNBT.inactive = not key.nbtHash
|
||||
self.ignoreNBT.inactive = not key.nbt
|
||||
self.ignoreNBT:draw()
|
||||
|
||||
elseif event.type == 'ignore_nbt' then
|
||||
local selected = self.grid:getSelected()
|
||||
local item = itemDB:splitKey(selected.key)
|
||||
item.nbtHash = nil
|
||||
item.nbt = nil
|
||||
selected.key = itemDB:makeKey(item)
|
||||
self.grid:draw()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user