VoxeLibre/mods/CORE/mcl_itemstack/init.lua

44 lines
881 B
Lua
Raw Normal View History

2021-03-17 11:08:14 +01:00
MCLItemStack = class()
function MCLItemStack:constructor(stack)
self.stack = stack
end
MCLItemStack:__getter("enchantments", function(self)
return mcl_enchanting.get_enchantments(self.stack)
end)
MCLItemStack:__comparator("enchantments", mcl_types.match_enchantments)
function MCLItemStack:meta()
return self.stack:get_meta()
end
MCLItemStack:__comparator("meta", mcl_types.match_meta)
function MCLItemStack:get_enchantment(name)
2021-03-17 15:21:27 +01:00
return self:enchantments()[name] or 0
2021-03-17 11:08:14 +01:00
end
function MCLItemStack:has_enchantment(name)
return self:get_enchantment(name) > 0
end
2021-03-17 15:21:27 +01:00
function MCLItemStack:total_durability()
end
2021-03-17 11:08:14 +01:00
function MCLItemStack:durability()
local def = self.stack:get_definition()
if def then
2021-03-17 15:21:27 +01:00
local base_uses = def._durability
2021-03-17 11:08:14 +01:00
end
end
2021-03-17 15:21:27 +01:00
function MCLItemStack:use_durability()
end
function MCLItemStack:restore_durability()
end
function MCLItemStack:get_group()
end