Skip to content

Commit 37d3638

Browse files
committed
Add CampfireCooking and CraftingSpecial recipes, and... Recipe class
1 parent 096fc59 commit 37d3638

File tree

5 files changed

+77
-32
lines changed

5 files changed

+77
-32
lines changed

JsonShapes/Recipes/BlastingRecipe.cs

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,16 @@
22

33
namespace SteveSharp.JsonShapes.Recipes;
44

5-
public class BlastingRecipe {
6-
public class RecipeIngredient {
7-
[JsonPropertyName("item")]
8-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
9-
public string? Item { get; set; }
10-
11-
[JsonPropertyName("tag")]
12-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
13-
public string? ItemTag { get; set; }
14-
}
15-
public class Result {
16-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
17-
[JsonPropertyName("id")]
18-
public string? Id { get; set; }
19-
20-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
21-
[JsonPropertyName("components")]
22-
public Dictionary<string, dynamic>? Components { get; set; }
23-
}
5+
public class BlastingRecipe : Recipe {
246

257
[JsonPropertyName("type")]
26-
public string Type { get; set; } = "minecraft:blasting";
27-
28-
[JsonPropertyName("ingredient")]
29-
public dynamic? Ingredient { get; set; }
30-
31-
[JsonPropertyName("result")]
32-
public Result? RecipeResult { get; set; }
8+
new public string Type { get; set; } = "minecraft:blasting";
339

3410
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
3511
[JsonPropertyName("experience")]
3612
public int Experience { get; set; }
3713

3814
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
3915
[JsonPropertyName("cookingtime")]
40-
public int CookingTIme { get; set; }
16+
public int CookingTime { get; set; }
4117
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Text.Json.Serialization;
2+
3+
public class CampfireCooking : Recipe {
4+
[JsonPropertyName("type")]
5+
new public string Type { get; set; } = "minecraft:campfire_cooking";
6+
7+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
8+
[JsonPropertyName("experience")]
9+
public int Experience { get; set; }
10+
11+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
12+
[JsonPropertyName("cookingtime")]
13+
public int CookingTime { get; set; }
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Text.Json.Serialization;
2+
3+
public class CraftingSpecial {
4+
[JsonPropertyName("type")]
5+
public string? Type { get; set; }
6+
7+
[JsonPropertyName("category")]
8+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
9+
public string? Category { get; set; }
10+
}

JsonShapes/Recipes/Recipe.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System.Text.Json.Serialization;
2+
3+
public class Recipe {
4+
5+
public class RecipeIngredient {
6+
[JsonPropertyName("item")]
7+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
8+
public string? Item { get; set; }
9+
10+
[JsonPropertyName("tag")]
11+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
12+
public string? ItemTag { get; set; }
13+
}
14+
public class RecipeResult {
15+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
16+
[JsonPropertyName("id")]
17+
public string? Id { get; set; }
18+
19+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
20+
[JsonPropertyName("components")]
21+
public Dictionary<string, dynamic>? Components { get; set; }
22+
}
23+
24+
[JsonPropertyName("type")]
25+
public string Type { get; set; } = "minecraft:blasting";
26+
27+
[JsonPropertyName("category")]
28+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
29+
public string? Category { get; set; }
30+
31+
[JsonPropertyName("group")]
32+
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
33+
public string? Group { get; set; }
34+
35+
[JsonPropertyName("ingredient")]
36+
public dynamic? Ingredient { get; set; }
37+
38+
[JsonPropertyName("result")]
39+
public RecipeResult? Result { get; set; }
40+
}

SteveSharp.sln

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ VisualStudioVersion = 17.5.33627.172
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SteveSharp", "SteveSharp.csproj", "{6D99B2F6-7D41-4357-B210-E5E909B653D8}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PersonalTests", "PersonalTests\PersonalTests.csproj", "{245455A0-9332-4BBD-82EE-A1575150FE5D}"
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PersonalTests", "PersonalTests", "{08CE972B-3385-4258-A89A-E901C870028E}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "PersonalTests\Tests\Tests.csproj", "{6642C65E-FF8E-4F33-A3E5-2552AEBD6CFB}"
911
EndProject
1012
Global
1113
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -17,15 +19,18 @@ Global
1719
{6D99B2F6-7D41-4357-B210-E5E909B653D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
1820
{6D99B2F6-7D41-4357-B210-E5E909B653D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
1921
{6D99B2F6-7D41-4357-B210-E5E909B653D8}.Release|Any CPU.Build.0 = Release|Any CPU
20-
{245455A0-9332-4BBD-82EE-A1575150FE5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21-
{245455A0-9332-4BBD-82EE-A1575150FE5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
22-
{245455A0-9332-4BBD-82EE-A1575150FE5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
23-
{245455A0-9332-4BBD-82EE-A1575150FE5D}.Release|Any CPU.Build.0 = Release|Any CPU
22+
{6642C65E-FF8E-4F33-A3E5-2552AEBD6CFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{6642C65E-FF8E-4F33-A3E5-2552AEBD6CFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{6642C65E-FF8E-4F33-A3E5-2552AEBD6CFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+
{6642C65E-FF8E-4F33-A3E5-2552AEBD6CFB}.Release|Any CPU.Build.0 = Release|Any CPU
2426
EndGlobalSection
2527
GlobalSection(SolutionProperties) = preSolution
2628
HideSolutionNode = FALSE
2729
EndGlobalSection
2830
GlobalSection(ExtensibilityGlobals) = postSolution
2931
SolutionGuid = {F4AAACE1-9BD0-4190-B3B9-8A837F2AAEA5}
3032
EndGlobalSection
33+
GlobalSection(NestedProjects) = preSolution
34+
{6642C65E-FF8E-4F33-A3E5-2552AEBD6CFB} = {08CE972B-3385-4258-A89A-E901C870028E}
35+
EndGlobalSection
3136
EndGlobal

0 commit comments

Comments
 (0)