From 2c25c9419985cc095e812409ac74a44b6cfc96b1 Mon Sep 17 00:00:00 2001 From: Araca Date: Thu, 28 Mar 2024 17:37:08 +0100 Subject: [PATCH] use math.ceil() instead of math.round() --- mods/HELP/mcl_tt/snippets_base.lua | 2 +- mods/HELP/mcl_tt/snippets_mcl.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/HELP/mcl_tt/snippets_base.lua b/mods/HELP/mcl_tt/snippets_base.lua index f20f3dfe2..a51560c32 100644 --- a/mods/HELP/mcl_tt/snippets_base.lua +++ b/mods/HELP/mcl_tt/snippets_base.lua @@ -86,7 +86,7 @@ tt.register_snippet(function(itemstring, toolcaps, itemstack) local real_uses = base_uses * math.pow(3, maxlevel) if real_uses < 65535 then if itemstack then - local remaining_uses = math.round(real_uses - (itemstack:get_wear() * base_uses) / 65535) + local remaining_uses = math.ceil(real_uses - (itemstack:get_wear() * base_uses) / 65535) miningusesstr = remaining_uses .. "/" .. real_uses else miningusesstr = S("@1 uses", real_uses) diff --git a/mods/HELP/mcl_tt/snippets_mcl.lua b/mods/HELP/mcl_tt/snippets_mcl.lua index 2066670f3..0f4d32560 100644 --- a/mods/HELP/mcl_tt/snippets_mcl.lua +++ b/mods/HELP/mcl_tt/snippets_mcl.lua @@ -41,7 +41,7 @@ tt.register_snippet(function(itemstring, _, itemstack) if unbreaking > 0 then use = math.floor(use / (0.6 + 0.4 / (unbreaking + 1))) end - remaining_uses = math.round(use - (itemstack:get_wear() * use) / 65535) + remaining_uses = math.ceil(use - (itemstack:get_wear() * use) / 65535) end if use > 0 then if use ~= remaining_uses then @@ -117,7 +117,7 @@ tt.register_snippet(function(itemstring, _, itemstack) if itemstring:sub(1, 23) == "mcl_fishing:fishing_rod" or itemstring:sub(1, 12) == "mcl_bows:bow" then local stack = itemstack or ItemStack(itemstring) local use = mcl_util.calculate_durability(stack) - local remaining_use = math.round(use - (stack:get_wear() * use) / 65535) + local remaining_use = math.ceil(use - (stack:get_wear() * use) / 65535) return S("Durability: @1", S("@1 uses", remaining_use .."/".. use)) end end)