revert use math.ceil() instead of math.round()
This commit is contained in:
the-real-herowl 2024-05-19 01:16:56 +00:00 committed by teknomunk
parent af9794685d
commit f795e3a7d1
2 changed files with 3 additions and 3 deletions

View File

@ -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.ceil(real_uses - (itemstack:get_wear() * base_uses) / 65535)
local remaining_uses = math.round(real_uses - (itemstack:get_wear() * base_uses) / 65535)
miningusesstr = remaining_uses .. "/" .. real_uses
else
miningusesstr = S("@1 uses", real_uses)

View File

@ -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.ceil(use - (itemstack:get_wear() * use) / 65535)
remaining_uses = math.round(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.ceil(use - (stack:get_wear() * use) / 65535)
local remaining_use = math.round(use - (stack:get_wear() * use) / 65535)
return S("Durability: @1", S("@1 uses", remaining_use .."/".. use))
end
end)