Add NBT custom name lookup

This commit is contained in:
Cody Young 2023-03-21 13:32:56 -05:00
parent 14bd08b16c
commit 0f4fe2bb81
1 changed files with 7 additions and 0 deletions

View File

@ -20,6 +20,13 @@ local function ItemStack_new(item)
end end
function ItemStack:getName() function ItemStack:getName()
--- check for custom name
if self.data.hasTagCompount() then
local nbt = self.data.getTagCompount()
if nbt.value.display and nbt.value.display.value.Name then
return nbt.value.display.value.Name.value
end
end
return self.data.getName() return self.data.getName()
end end