From df0c1f1dd1e32dc74a1b9e9a767037c517cdf071 Mon Sep 17 00:00:00 2001 From: Emily Date: Fri, 6 Aug 2021 11:14:17 +0200 Subject: [PATCH 1/2] Make bows and fishing rods show their durability in description (Fixes issue #1773) --- mods/HELP/mcl_tt/snippets_mcl.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mods/HELP/mcl_tt/snippets_mcl.lua b/mods/HELP/mcl_tt/snippets_mcl.lua index 3c79f52e8a..121d8ed70e 100644 --- a/mods/HELP/mcl_tt/snippets_mcl.lua +++ b/mods/HELP/mcl_tt/snippets_mcl.lua @@ -107,3 +107,8 @@ tt.register_snippet(function(itemstring) end end) +tt.register_snippet(function(itemstring, _, itemstack) + if itemstring:sub(1, 23) == "mcl_fishing:fishing_rod" or itemstring:sub(1, 12) == "mcl_bows:bow" then + return S("Durability: @1 uses", mcl_util.calculate_durability(itemstack or ItemStack(itemstring))) + end +end) From 5bb57a81ad46c163b58da046920b8a4bee18b30b Mon Sep 17 00:00:00 2001 From: Emily Date: Fri, 6 Aug 2021 11:55:27 +0200 Subject: [PATCH 2/2] Add durability tooltip to translation template --- mods/HELP/mcl_tt/locale/template.txt | 1 + mods/HELP/mcl_tt/snippets_mcl.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/HELP/mcl_tt/locale/template.txt b/mods/HELP/mcl_tt/locale/template.txt index 1259216c76..6fb735b139 100644 --- a/mods/HELP/mcl_tt/locale/template.txt +++ b/mods/HELP/mcl_tt/locale/template.txt @@ -45,3 +45,4 @@ Mining durability: @1= Block breaking strength: @1= @1 uses= Unlimited uses= +Durability: @1= diff --git a/mods/HELP/mcl_tt/snippets_mcl.lua b/mods/HELP/mcl_tt/snippets_mcl.lua index 121d8ed70e..825776f5f2 100644 --- a/mods/HELP/mcl_tt/snippets_mcl.lua +++ b/mods/HELP/mcl_tt/snippets_mcl.lua @@ -109,6 +109,6 @@ end) tt.register_snippet(function(itemstring, _, itemstack) if itemstring:sub(1, 23) == "mcl_fishing:fishing_rod" or itemstring:sub(1, 12) == "mcl_bows:bow" then - return S("Durability: @1 uses", mcl_util.calculate_durability(itemstack or ItemStack(itemstring))) + return S("Durability: @1", S("@1 uses", mcl_util.calculate_durability(itemstack or ItemStack(itemstring)))) end end)