2020-10-27 18:53:49 +00:00
|
|
|
function mcl_enchanting.enchantments_snippet(_, _, itemstack)
|
|
|
|
if not itemstack then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
local enchantments = mcl_enchanting.get_enchantments(itemstack)
|
|
|
|
local text = ""
|
|
|
|
for enchantment, level in pairs(enchantments) do
|
2020-11-01 12:44:05 +00:00
|
|
|
text = text .. mcl_enchanting.get_colorized_enchantment_description(enchantment, level) .. "\n"
|
2020-10-27 18:53:49 +00:00
|
|
|
end
|
|
|
|
if text ~= "" then
|
2020-11-01 13:23:43 +00:00
|
|
|
if not itemstack:get_definition()._tt_original_description then
|
|
|
|
text = text:sub(1, text:len() - 1)
|
|
|
|
end
|
|
|
|
return text, false
|
2020-10-27 18:53:49 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
table.insert(tt.registered_snippets, 1, mcl_enchanting.enchantments_snippet)
|