from typing import Any from bta_proxy.datainputstream import AsyncDataInputStream, SyncDataInputStream class ItemStack: __slots__ = ("item_id", "count", "data", "tag") def __init__(self, item_id: int, count: int, data: int, tag: Any = None): self.item_id = item_id self.count = count self.data = data self.tag = tag @classmethod async def read_from(cls, stream: AsyncDataInputStream) -> 'ItemStack': item_id = await stream.read_short() count = await stream.read() data = await stream.read_ushort() return cls(item_id, count, data) @classmethod def read_from_sync(cls, stream: SyncDataInputStream) -> 'ItemStack': item_id = stream.read_short() count = stream.read() data = stream.read_ushort() return cls(item_id, count, data) def __bool__(self): return self.item_id > 0 and self.count > 0 def __repr__(self): if self.tag: return f'' return f''