Moved brick oven recipes to be 100% on config.
parent
48fd361636
commit
d0e014ddfa
|
@ -2,6 +2,7 @@ package net.einsteinsci.betterbeginnings.config.json;
|
||||||
|
|
||||||
import net.einsteinsci.betterbeginnings.util.FileUtil;
|
import net.einsteinsci.betterbeginnings.util.FileUtil;
|
||||||
import net.einsteinsci.betterbeginnings.util.LogUtil;
|
import net.einsteinsci.betterbeginnings.util.LogUtil;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.common.Loader;
|
import net.minecraftforge.fml.common.Loader;
|
||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
import org.apache.logging.log4j.Level;
|
import org.apache.logging.log4j.Level;
|
||||||
|
@ -14,9 +15,22 @@ public class BrickOvenConfig implements IJsonConfig
|
||||||
{
|
{
|
||||||
public static final BrickOvenConfig INSTANCE = new BrickOvenConfig();
|
public static final BrickOvenConfig INSTANCE = new BrickOvenConfig();
|
||||||
|
|
||||||
|
private static JsonBrickOvenRecipeHandler initialRecipes = new JsonBrickOvenRecipeHandler();
|
||||||
|
|
||||||
private JsonBrickOvenRecipeHandler mainRecipes = new JsonBrickOvenRecipeHandler();
|
private JsonBrickOvenRecipeHandler mainRecipes = new JsonBrickOvenRecipeHandler();
|
||||||
|
private JsonBrickOvenRecipeHandler customRecipes = new JsonBrickOvenRecipeHandler();
|
||||||
|
|
||||||
private List<JsonBrickOvenRecipeHandler> includes = new ArrayList<>();
|
private List<JsonBrickOvenRecipeHandler> includes = new ArrayList<>();
|
||||||
|
|
||||||
|
public static void addShapedRecipe(ItemStack output, Object... args)
|
||||||
|
{
|
||||||
|
initialRecipes.getShaped().add(new JsonBrickOvenShapedRecipe(output, args));
|
||||||
|
}
|
||||||
|
public static void addShapelessRecipe(ItemStack output, Object... args)
|
||||||
|
{
|
||||||
|
initialRecipes.getShapeless().add(new JsonBrickOvenShapelessRecipe(output, args));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSubFolder()
|
public String getSubFolder()
|
||||||
{
|
{
|
||||||
|
@ -30,7 +44,8 @@ public class BrickOvenConfig implements IJsonConfig
|
||||||
String json = FileUtil.readAllText(mainf);
|
String json = FileUtil.readAllText(mainf);
|
||||||
if (json == null)
|
if (json == null)
|
||||||
{
|
{
|
||||||
json = "{}";
|
// Kind of inefficient, but it's easiest this way.
|
||||||
|
json = BBJsonLoader.serializeObject(initialRecipes);
|
||||||
}
|
}
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
|
@ -45,14 +60,21 @@ public class BrickOvenConfig implements IJsonConfig
|
||||||
@Override
|
@Override
|
||||||
public String getCustomJson(File subfolder)
|
public String getCustomJson(File subfolder)
|
||||||
{
|
{
|
||||||
return "{}";
|
File customf = new File(subfolder, "custom.json");
|
||||||
|
String json = FileUtil.readAllText(customf);
|
||||||
|
if (json == null)
|
||||||
|
{
|
||||||
|
json = "{}";
|
||||||
|
}
|
||||||
|
|
||||||
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getIncludedJson(File subfolder)
|
public List<String> getIncludedJson(File subfolder)
|
||||||
{
|
{
|
||||||
List<String> res = new ArrayList<>();
|
List<String> res = new ArrayList<>();
|
||||||
for (String fileName : mainRecipes.getIncludes())
|
for (String fileName : customRecipes.getIncludes())
|
||||||
{
|
{
|
||||||
File incf = new File(subfolder, fileName);
|
File incf = new File(subfolder, fileName);
|
||||||
String json = FileUtil.readAllText(incf);
|
String json = FileUtil.readAllText(incf);
|
||||||
|
@ -66,16 +88,24 @@ public class BrickOvenConfig implements IJsonConfig
|
||||||
public void loadJsonConfig(FMLInitializationEvent e, String mainJson, String autoJson, String customJson)
|
public void loadJsonConfig(FMLInitializationEvent e, String mainJson, String autoJson, String customJson)
|
||||||
{
|
{
|
||||||
mainRecipes = BBJsonLoader.deserializeObject(mainJson, JsonBrickOvenRecipeHandler.class);
|
mainRecipes = BBJsonLoader.deserializeObject(mainJson, JsonBrickOvenRecipeHandler.class);
|
||||||
|
|
||||||
for (JsonBrickOvenShapedRecipe j : mainRecipes.getShaped())
|
for (JsonBrickOvenShapedRecipe j : mainRecipes.getShaped())
|
||||||
{
|
{
|
||||||
j.register();
|
j.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (JsonBrickOvenShapelessRecipe j : mainRecipes.getShapeless())
|
for (JsonBrickOvenShapelessRecipe j : mainRecipes.getShapeless())
|
||||||
{
|
{
|
||||||
j.register();
|
j.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
customRecipes = BBJsonLoader.deserializeObject(customJson, JsonBrickOvenRecipeHandler.class);
|
||||||
|
for (JsonBrickOvenShapedRecipe r : customRecipes.getShaped())
|
||||||
|
{
|
||||||
|
r.register();
|
||||||
|
}
|
||||||
|
for (JsonBrickOvenShapelessRecipe r : customRecipes.getShapeless())
|
||||||
|
{
|
||||||
|
r.register();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -127,4 +157,9 @@ public class BrickOvenConfig implements IJsonConfig
|
||||||
{
|
{
|
||||||
return mainRecipes;
|
return mainRecipes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JsonBrickOvenRecipeHandler getCustomRecipes()
|
||||||
|
{
|
||||||
|
return customRecipes;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,16 +18,23 @@ public class JsonBrickOvenRecipeHandler
|
||||||
private List<String> __COMMENTS = new ArrayList<>();
|
private List<String> __COMMENTS = new ArrayList<>();
|
||||||
|
|
||||||
public JsonBrickOvenRecipeHandler()
|
public JsonBrickOvenRecipeHandler()
|
||||||
|
{
|
||||||
|
this(false);
|
||||||
|
}
|
||||||
|
public JsonBrickOvenRecipeHandler(boolean includeTesting)
|
||||||
{
|
{
|
||||||
__COMMENTS = new ArrayList<>();
|
__COMMENTS = new ArrayList<>();
|
||||||
__COMMENTS.add("Brick Oven recipes do not support ore dictionary in ingredients.");
|
__COMMENTS.add("Brick Oven recipes do not support ore dictionary in ingredients.");
|
||||||
__COMMENTS.add("This will change eventually. This only applies to Brick Oven recipes.");
|
__COMMENTS.add("This will change eventually. This only applies to Brick Oven recipes.");
|
||||||
|
|
||||||
// TESTING ONLY
|
if (includeTesting)
|
||||||
shaped.add(new JsonBrickOvenShapedRecipe(new ItemStack(Items.beef), "x ", "ox", 'x',
|
{
|
||||||
Blocks.bedrock, 'o', Items.chainmail_chestplate));
|
// TESTING ONLY
|
||||||
|
shaped.add(new JsonBrickOvenShapedRecipe(new ItemStack(Items.beef), "x ", "ox", 'x',
|
||||||
|
Blocks.bedrock, 'o', Items.chainmail_chestplate));
|
||||||
|
|
||||||
shapeless.add(new JsonBrickOvenShapelessRecipe(new ItemStack(Items.porkchop), Blocks.bedrock, Items.chainmail_boots));
|
shapeless.add(new JsonBrickOvenShapelessRecipe(new ItemStack(Items.porkchop), Blocks.bedrock, Items.chainmail_boots));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<JsonBrickOvenShapedRecipe> getShaped()
|
public List<JsonBrickOvenShapedRecipe> getShaped()
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.einsteinsci.betterbeginnings.register;
|
||||||
|
|
||||||
import net.einsteinsci.betterbeginnings.config.BBConfig;
|
import net.einsteinsci.betterbeginnings.config.BBConfig;
|
||||||
import net.einsteinsci.betterbeginnings.config.json.AdvancedCraftingConfig;
|
import net.einsteinsci.betterbeginnings.config.json.AdvancedCraftingConfig;
|
||||||
|
import net.einsteinsci.betterbeginnings.config.json.BrickOvenConfig;
|
||||||
import net.einsteinsci.betterbeginnings.config.json.KilnConfig;
|
import net.einsteinsci.betterbeginnings.config.json.KilnConfig;
|
||||||
import net.einsteinsci.betterbeginnings.config.json.SmelterConfig;
|
import net.einsteinsci.betterbeginnings.config.json.SmelterConfig;
|
||||||
import net.einsteinsci.betterbeginnings.items.ItemCharredMeat;
|
import net.einsteinsci.betterbeginnings.items.ItemCharredMeat;
|
||||||
|
@ -102,40 +103,40 @@ public class RegisterRecipes
|
||||||
|
|
||||||
private static void addBrickOvenRecipes()
|
private static void addBrickOvenRecipes()
|
||||||
{
|
{
|
||||||
BrickOvenRecipeHandler.addShapedRecipe(new ItemStack(Items.golden_apple), "GGG", "GAG", "GGG", 'G',
|
BrickOvenConfig.addShapedRecipe(new ItemStack(Items.golden_apple), "GGG", "GAG", "GGG", 'G',
|
||||||
Items.gold_ingot, 'A', Items.apple);
|
Items.gold_ingot, 'A', Items.apple);
|
||||||
BrickOvenRecipeHandler.addShapedRecipe(new ItemStack(Items.golden_apple, 1, 1), "###", "#A#", "###", '#',
|
BrickOvenConfig.addShapedRecipe(new ItemStack(Items.golden_apple, 1, 1), "###", "#A#", "###", '#',
|
||||||
Blocks.gold_block, 'A', Items.apple);
|
Blocks.gold_block, 'A', Items.apple);
|
||||||
BrickOvenRecipeHandler.addShapedRecipe(new ItemStack(Items.cake), "MMM", "SES", "WWW", 'M', Items.milk_bucket,
|
BrickOvenConfig.addShapedRecipe(new ItemStack(Items.cake), "MMM", "SES", "WWW", 'M', Items.milk_bucket,
|
||||||
'S', Items.sugar, 'E', Items.egg, 'W', Items.wheat);
|
'S', Items.sugar, 'E', Items.egg, 'W', Items.wheat);
|
||||||
BrickOvenRecipeHandler.addShapedRecipe(new ItemStack(Items.bread, 2), "WWW", 'W', Items.wheat);
|
BrickOvenConfig.addShapedRecipe(new ItemStack(Items.bread, 2), "WWW", 'W', Items.wheat);
|
||||||
BrickOvenRecipeHandler.addShapedRecipe(new ItemStack(Items.cookie, 8), "WCW", 'W', Items.wheat, 'C',
|
BrickOvenConfig.addShapedRecipe(new ItemStack(Items.cookie, 8), "WCW", 'W', Items.wheat, 'C',
|
||||||
new ItemStack(Items.dye, 1, 3)); // Cocoa bean
|
new ItemStack(Items.dye, 1, 3)); // Cocoa bean
|
||||||
BrickOvenRecipeHandler.addShapedRecipe(new ItemStack(Items.rabbit_stew), " R ", "CPM", " B ",
|
BrickOvenConfig.addShapedRecipe(new ItemStack(Items.rabbit_stew), " R ", "CPM", " B ",
|
||||||
'R', Items.cooked_rabbit, 'C', Items.carrot, 'P', Items.baked_potato,
|
'R', Items.cooked_rabbit, 'C', Items.carrot, 'P', Items.baked_potato,
|
||||||
'M', Blocks.brown_mushroom, 'B', Items.bowl);
|
'M', Blocks.brown_mushroom, 'B', Items.bowl);
|
||||||
BrickOvenRecipeHandler.addShapedRecipe(new ItemStack(Items.rabbit_stew), " R ", "CPM", " B ",
|
BrickOvenConfig.addShapedRecipe(new ItemStack(Items.rabbit_stew), " R ", "CPM", " B ",
|
||||||
'R', Items.cooked_rabbit, 'C', Items.carrot, 'P', Items.baked_potato,
|
'R', Items.cooked_rabbit, 'C', Items.carrot, 'P', Items.baked_potato,
|
||||||
'M', Blocks.red_mushroom, 'B', Items.bowl);
|
'M', Blocks.red_mushroom, 'B', Items.bowl);
|
||||||
BrickOvenRecipeHandler.addShapedRecipe(new ItemStack(RegisterItems.marshmallow, 3), " S ", "SSS", " S ",
|
BrickOvenConfig.addShapedRecipe(new ItemStack(RegisterItems.marshmallow, 3), " S ", "SSS", " S ",
|
||||||
'S', Items.sugar);
|
'S', Items.sugar);
|
||||||
|
|
||||||
BrickOvenRecipeHandler.addShapelessRecipe(new ItemStack(Items.mushroom_stew), Blocks.brown_mushroom,
|
BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.mushroom_stew), Blocks.brown_mushroom,
|
||||||
Blocks.red_mushroom, Items.bowl);
|
Blocks.red_mushroom, Items.bowl);
|
||||||
BrickOvenRecipeHandler.addShapelessRecipe(new ItemStack(Items.cooked_beef), Items.beef);
|
BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.cooked_beef), Items.beef);
|
||||||
BrickOvenRecipeHandler.addShapelessRecipe(new ItemStack(Items.cooked_porkchop), Items.porkchop);
|
BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.cooked_porkchop), Items.porkchop);
|
||||||
BrickOvenRecipeHandler.addShapelessRecipe(new ItemStack(Items.cooked_chicken), Items.chicken);
|
BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.cooked_chicken), Items.chicken);
|
||||||
BrickOvenRecipeHandler.addShapelessRecipe(new ItemStack(Items.cooked_fish), Items.fish);
|
BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.cooked_fish), Items.fish);
|
||||||
BrickOvenRecipeHandler.addShapelessRecipe(new ItemStack(Items.cooked_fish, 1, 1),
|
BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.cooked_fish, 1, 1),
|
||||||
new ItemStack(Items.fish, 1, 1));
|
new ItemStack(Items.fish, 1, 1));
|
||||||
BrickOvenRecipeHandler.addShapelessRecipe(new ItemStack(Items.cooked_rabbit), Items.rabbit);
|
BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.cooked_rabbit), Items.rabbit);
|
||||||
BrickOvenRecipeHandler.addShapelessRecipe(new ItemStack(Items.cooked_mutton), Items.mutton);
|
BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.cooked_mutton), Items.mutton);
|
||||||
BrickOvenRecipeHandler.addShapelessRecipe(new ItemStack(Items.baked_potato), Items.potato);
|
BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.baked_potato), Items.potato);
|
||||||
BrickOvenRecipeHandler.addShapelessRecipe(new ItemStack(Items.pumpkin_pie), Items.egg, Items.sugar,
|
BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.pumpkin_pie), Items.egg, Items.sugar,
|
||||||
Blocks.pumpkin);
|
Blocks.pumpkin);
|
||||||
BrickOvenRecipeHandler.addShapelessRecipe(new ItemStack(Items.fermented_spider_eye), Items.spider_eye,
|
BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.fermented_spider_eye), Items.spider_eye,
|
||||||
Items.sugar, Blocks.brown_mushroom);
|
Items.sugar, Blocks.brown_mushroom);
|
||||||
BrickOvenRecipeHandler.addShapelessRecipe(new ItemStack(Items.magma_cream),
|
BrickOvenConfig.addShapelessRecipe(new ItemStack(Items.magma_cream),
|
||||||
Items.slime_ball, Items.blaze_powder);
|
Items.slime_ball, Items.blaze_powder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,12 +13,8 @@ public class BrickOvenRecipeHandler
|
||||||
private static final BrickOvenRecipeHandler INSTANCE = new BrickOvenRecipeHandler();
|
private static final BrickOvenRecipeHandler INSTANCE = new BrickOvenRecipeHandler();
|
||||||
protected List<IBrickOvenRecipe> recipes = new ArrayList<IBrickOvenRecipe>();
|
protected List<IBrickOvenRecipe> recipes = new ArrayList<IBrickOvenRecipe>();
|
||||||
|
|
||||||
// private Map experienceList;
|
|
||||||
|
|
||||||
public BrickOvenRecipeHandler()
|
public BrickOvenRecipeHandler()
|
||||||
{
|
{ }
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addShapedRecipe(ItemStack output, Object... args)
|
public static void addShapedRecipe(ItemStack output, Object... args)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue