internal ItemStack(BigEndianStream stream) { Type = stream.ReadShort(); if (Type >= 0) { Count = stream.ReadSByte(); Durability = stream.ReadShort(); } }
internal ItemStack(BigEndianStream stream) { Type = stream.ReadShort(); if (Type >= 0) { Count = stream.ReadSByte(); Durability = stream.ReadShort(); // TODO: Implement extra data read (enchantment) and items if (Durability > 0 || IsEnchantable()) stream.ReadShort(); } }
public static ItemInventory GetInstance(BigEndianStream stream) { ItemInventory item = Void; Type itemClass; short type = stream.ReadShort(); if (type >= 0) { if (_itemClasses.TryGetValue(type, out itemClass)) { item = (ItemInventory) itemClass.GetConstructor(Type.EmptyTypes).Invoke(null); item.Count = stream.ReadSByte(); item.Durability = stream.ReadShort(); // TODO: Implement extra data read (enchantment) and items //if (item.Durability > 0 || item.IsEnchantable) stream.ReadShort(); } } return item; }
internal static ItemStack Read(BigEndianStream stream) { ItemStack retval = new ItemStack(stream.ReadShort()); if (retval.Type >= 0) { retval.Count = stream.ReadSByte(); retval.Durability = stream.ReadShort(); } return retval; }