Add method to register items as repairable (#145)

master
Jordan Irwin 2021-07-07 09:28:25 -07:00 committed by GitHub
parent 8acc028481
commit 3103d426d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -36,8 +36,15 @@ workbench.defs = {
local repairable_tools = {"pick", "axe", "shovel", "sword", "hoe", "armor", "shield"}
local custom_repairable = {}
function xdecor:register_repairable(item)
custom_repairable[item] = true
end
-- Tools allowed to be repaired
function workbench:repairable(stack)
if custom_repairable[stack] then return true end
for _, t in ipairs(repairable_tools) do
if stack:find(t) then
return true