MCPcopy Create free account
hub / github.com/cuberite/cuberite / ParseItem

Method ParseItem

src/Protocol/Protocol125.cpp:1732–1771  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1730
1731
1732int cProtocol125::ParseItem(cItem & a_Item)
1733{
1734 HANDLE_PACKET_READ(ReadBEShort, short, ItemType);
1735
1736 if (ItemType <= -1)
1737 {
1738 a_Item.Empty();
1739 return PARSE_OK;
1740 }
1741 a_Item.m_ItemType = ItemType;
1742
1743 HANDLE_PACKET_READ(ReadChar, char, ItemCount);
1744 HANDLE_PACKET_READ(ReadBEShort, short, ItemDamage);
1745 a_Item.m_ItemCount = ItemCount;
1746 a_Item.m_ItemDamage = ItemDamage;
1747 if (ItemCount <= 0)
1748 {
1749 a_Item.Empty();
1750 }
1751
1752 if (!cItem::IsEnchantable(ItemType))
1753 {
1754 return PARSE_OK;
1755 }
1756
1757 HANDLE_PACKET_READ(ReadBEShort, short, EnchantNumBytes);
1758
1759 if (EnchantNumBytes <= 0)
1760 {
1761 return PARSE_OK;
1762 }
1763
1764 // TODO: Enchantment not implemented yet!
1765 if (!m_ReceivedData.SkipRead((size_t)EnchantNumBytes))
1766 {
1767 return PARSE_INCOMPLETE;
1768 }
1769
1770 return PARSE_OK;
1771}
1772
1773
1774

Callers

nothing calls this directly

Calls 2

EmptyMethod · 0.80
SkipReadMethod · 0.80

Tested by

no test coverage detected