From a460bc31f3d608bf7235b264e0a21861f54f3856 Mon Sep 17 00:00:00 2001 From: kepler155c Date: Wed, 14 Nov 2018 14:22:43 -0500 Subject: [PATCH] itemdb potion hack --- core/apis/itemDB.lua | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/core/apis/itemDB.lua b/core/apis/itemDB.lua index 21d0442..8d2174c 100644 --- a/core/apis/itemDB.lua +++ b/core/apis/itemDB.lua @@ -115,25 +115,31 @@ function itemDB:add(baseItem) nItem.maxCount = baseItem.maxCount nItem.maxDamage = baseItem.maxDamage - for k,item in pairs(self.data) do - if nItem.name == item.name and - nItem.displayName == item.displayName then + -- potions can have the same damage, diff nbts, but same names + -- ie. potion of healing, potion of healing II + -- both show as "Potion of Healing" - if nItem.nbtHash ~= item.nbtHash and nItem.damage ~= item.damage then - nItem.damage = '*' - nItem.nbtHash = nil - nItem.ignoreNBT = true - self.data[k] = nil - break - elseif nItem.damage ~= item.damage then - nItem.damage = '*' - self.data[k] = nil - break - elseif nItem.nbtHash ~= item.nbtHash then - nItem.nbtHash = nil - nItem.ignoreNBT = true - self.data[k] = nil - break + if nItem.name ~= 'minecraft:potion' --[[ HACK ]] then + for k,item in pairs(self.data) do + if nItem.name == item.name and + nItem.displayName == item.displayName then + + if nItem.nbtHash ~= item.nbtHash and nItem.damage ~= item.damage then + nItem.damage = '*' + nItem.nbtHash = nil + nItem.ignoreNBT = true + self.data[k] = nil + break + elseif nItem.damage ~= item.damage then + nItem.damage = '*' + self.data[k] = nil + break + elseif nItem.nbtHash ~= item.nbtHash then + nItem.nbtHash = nil + nItem.ignoreNBT = true + self.data[k] = nil + break + end end end end