forked from VoxeLibre/VoxeLibre
use math.ceil() instead of math.round()
This commit is contained in:
parent
50f3f2c5c8
commit
2c25c94199
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue