fix disenchant bugs from setdurability etc

This commit is contained in:
sylvessa
2026-04-18 14:31:19 -05:00
committed by itsRevela
parent f9cac6395b
commit 2e0f4f91d6
2 changed files with 6 additions and 8 deletions

View File

@@ -154,7 +154,7 @@ public class ItemMeta
/// <param name="enchants">The enchantments to set.</param>
public void setEnchants(Dictionary<EnchantmentType, int>? enchants)
{
enchants = enchants != null ? new Dictionary<EnchantmentType, int>(enchants) : null;
_enchants = enchants != null ? new Dictionary<EnchantmentType, int>(enchants) : null;
}

View File

@@ -828,16 +828,14 @@ int __cdecl NativeGetItemMeta(int entityId, int slot, char *outBuf, int bufSize)
return 0;
CompoundTag *tag = item->getTag();
if (!tag || !tag->contains(L"display"))
return 0;
CompoundTag *display = tag->getCompound(L"display");
bool hasName = display->contains(L"Name");
bool hasLore = display->contains(L"Lore");
bool hasEnchantments = item->isEnchanted();
if (!hasName && !hasLore)
CompoundTag *display = (tag && tag->contains(L"display")) ? tag->getCompound(L"display") : nullptr;
bool hasName = display && display->contains(L"Name");
bool hasLore = display && display->contains(L"Lore");
if (!hasName && !hasLore && !hasEnchantments)
return 0;
int offset = 0;