diff --git a/Minecraft.Server.FourKit/Inventory/Meta/ItemMeta.cs b/Minecraft.Server.FourKit/Inventory/Meta/ItemMeta.cs index 60ba224cf..d9913a428 100644 --- a/Minecraft.Server.FourKit/Inventory/Meta/ItemMeta.cs +++ b/Minecraft.Server.FourKit/Inventory/Meta/ItemMeta.cs @@ -154,7 +154,7 @@ public class ItemMeta /// The enchantments to set. public void setEnchants(Dictionary? enchants) { - enchants = enchants != null ? new Dictionary(enchants) : null; + _enchants = enchants != null ? new Dictionary(enchants) : null; } diff --git a/Minecraft.Server/FourKitNatives.cpp b/Minecraft.Server/FourKitNatives.cpp index 1c522f40b..a79d53f36 100644 --- a/Minecraft.Server/FourKitNatives.cpp +++ b/Minecraft.Server/FourKitNatives.cpp @@ -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;