Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions common/src/main/java/dev/ninjdai/letsdocompat/RecipeJsonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@ public final class RecipeJsonUtil {
FDCookingPotRecipe.add("type", new JsonPrimitive("farmersdelight:cooking"));
FDCookingPotRecipe.add("recipe_book_tab", new JsonPrimitive("meals"));
FDCookingPotRecipe.add("ingredients", ldRecipe.getAsJsonArray("ingredients"));
if (ldRecipe.has("container") && ldRecipe.getAsJsonPrimitive("requireContainer").getAsBoolean()) {
if (ldRecipe.has("container")
&& ldRecipe.has("requireContainer")
&& ldRecipe.get("requireContainer").isJsonPrimitive()
&& ldRecipe.getAsJsonPrimitive("requireContainer").isBoolean()
&& ldRecipe.getAsJsonPrimitive("requireContainer").getAsBoolean()) {
FDCookingPotRecipe.add("container", ldRecipe.get("container"));
}
FDCookingPotRecipe.add("result", ldRecipe.get("result"));

return FDCookingPotRecipe;
};

@Nullable
@Nullable
public static final RecipeConvertor generateLDCookingPotFromFDCookingPot = (fdRecipe) -> {
JsonObject letsDoCookingPotRecipe = new JsonObject();
letsDoCookingPotRecipe.add("type", new JsonPrimitive("farm_and_charm:pot_cooking"));
Expand Down Expand Up @@ -61,7 +65,7 @@ public final class RecipeJsonUtil {
return letsDoCookingPotRecipe;
};

public static final RecipeConvertor generateCreateMixerFromFCBowl = (jsonRecipe) -> {
public static final RecipeConvertor generateCreateMixerFromFCBowl = (jsonRecipe) -> {
JsonObject createMixerRecipe = new JsonObject();
createMixerRecipe.add("type", new JsonPrimitive("create:mixing"));
createMixerRecipe.add("ingredients", jsonRecipe.getAsJsonArray("ingredients"));
Expand All @@ -72,7 +76,7 @@ public final class RecipeJsonUtil {

return createMixerRecipe;
};

public static final RecipeConvertor generateCreateMillingFromFDMincer = (jsonRecipe) -> {
JsonObject createMillingRecipe = new JsonObject();
createMillingRecipe.add("type", new JsonPrimitive("create:milling"));
Expand All @@ -88,7 +92,7 @@ public final class RecipeJsonUtil {

return createMillingRecipe;
};

static {
RECIPE_CONVERSION_MAP.put("farm_and_charm:pot_cooking", List.of(
new Tuple<>("farmersdelight", RecipeJsonUtil.generateFDCookingPotFromLDCookingPot)
Expand All @@ -104,4 +108,4 @@ public final class RecipeJsonUtil {
public interface RecipeConvertor {
JsonObject generate(JsonObject jsonRecipe);
}
}
}