Initial Commit
This commit is contained in:
commit
69a2ef0686
10 changed files with 209 additions and 0 deletions
49
MinecraftRecipe.cs
Normal file
49
MinecraftRecipe.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue