49 lines
No EOL
1.2 KiB
C#
49 lines
No EOL
1.2 KiB
C#
using Newtonsoft.Json;
|
|
|
|
namespace RecipeRevamper;
|
|
|
|
[JsonObject]
|
|
public class MinecraftRecipe
|
|
{
|
|
public struct ItemResult
|
|
{
|
|
public string? Item;
|
|
public int? Count;
|
|
public double? Chance;
|
|
}
|
|
public struct ItemIngredient
|
|
{
|
|
public string? Item;
|
|
}
|
|
|
|
public string? Type;
|
|
public List<ItemIngredient> Ingredients = new();
|
|
public List<ItemResult> Results = new();
|
|
public int ProcessingTime = 50;
|
|
|
|
public MinecraftRecipe Copy()
|
|
{
|
|
var newRecipe = new MinecraftRecipe();
|
|
newRecipe.Type = this.Type;
|
|
foreach (ItemIngredient ingredient in Ingredients)
|
|
{
|
|
newRecipe.Ingredients.Add(new ItemIngredient{Item = ingredient.Item,} );
|
|
}
|
|
foreach (ItemResult result in Results)
|
|
{
|
|
newRecipe.Results.Add(new ItemResult
|
|
{
|
|
Item = result.Item,
|
|
Count = result.Count,
|
|
Chance = result.Chance
|
|
});
|
|
}
|
|
|
|
return newRecipe;
|
|
}
|
|
|
|
public string Serialize()
|
|
{
|
|
return MinecraftRecipeSerializer.SerializeObject(this);
|
|
}
|
|
} |