bta-proxy/bta_proxy/itemstack.py

18 lines
524 B
Python
Raw Normal View History

2023-08-24 17:40:23 +03:00
2023-08-25 21:49:10 +03:00
from bta_proxy.datainputstream import AsyncDataInputStream
2023-08-24 17:40:23 +03:00
class ItemStack:
__slots__ = ("item_id", "count", "data")
def __init__(self, item_id: int, count: int, data: int):
self.item_id = item_id
self.count = count
self.data = data
@classmethod
2023-08-25 21:49:10 +03:00
async def read_from(cls, stream: AsyncDataInputStream) -> 'ItemStack':
item_id = await stream.read_short()
count = await stream.read()
data = await stream.read_ushort()
2023-08-24 17:40:23 +03:00
return cls(item_id, count, data)