/// <summary> /// Serialized the recipe /// </summary> /// <param name="writer"></param> public void ToBytes(BinaryWriter writer) { writer.Write(Width); writer.Write(Height); Output.ToBytes(writer); writer.Write(Shapeless); for (int i = 0; i < resolvedIngredients.Length; i++) { if (resolvedIngredients[i] == null) { writer.Write(true); continue; } writer.Write(false); resolvedIngredients[i].ToBytes(writer); } writer.Write(Name.ToShortString()); writer.Write(Attributes == null); if (Attributes != null) { writer.Write(Attributes.Token.ToString()); } writer.Write(RequiresTrait != null); if (RequiresTrait != null) { writer.Write(RequiresTrait); } }
/// <summary> /// Saves the ItemStack to file. /// </summary> /// <param name="writer">The writer to save the item to.</param> public virtual void ToBytes(BinaryWriter writer) { writer.Write((short)Type); writer.Write(Code.ToShortString()); writer.Write(StackSize); writer.Write(ResolvedItemstack != null); if (ResolvedItemstack != null) { ResolvedItemstack.ToBytes(writer); } }
/// <summary> /// The save data writer. /// </summary> /// <param name="writer">The writer to write blocks to.</param> public virtual void ToBytes(BinaryWriter writer) { writer.Write((short)Type); writer.Write(Code.ToShortString()); Quantity.ToBytes(writer); ResolvedItemstack.ToBytes(writer); writer.Write(LastDrop); writer.Write(DropModbyStat != null); if (DropModbyStat != null) { writer.Write(DropModbyStat); } }