As requested in #299, allow the grindstone to grind metals that aren't in Steamcraft via the oredict. Configurable.

dev
Arona Jones 2015-08-21 17:51:00 +01:00
parent 46f97a608a
commit 5976778e42
2 changed files with 40 additions and 7 deletions

View File

@ -36,11 +36,15 @@ public class ConfigGeneral
public static boolean unnaturalLightningStrikes, naturalLightningStrikes, weather2LightningStrikes;
public static int depthsBiomeID, depthsFBiomeID, depthsMBiomeID, depthsSBiomeID, depthsIBiomeID, depthsSCBiomeID, depthsSCHBiomeID, depthsSWBiomeID,
depthsTFBiomeID, depthsJBiomeID;// , depthsOBiomeID, depthsBBiomeID;
public static int depthsBiomeID, depthsFBiomeID, depthsMBiomeID, depthsSBiomeID, depthsIBiomeID, depthsSCBiomeID, depthsSCHBiomeID,
depthsSWBiomeID, depthsTFBiomeID, depthsJBiomeID;// ,
// depthsOBiomeID,
// depthsBBiomeID;
public static double spyglassZoom;
public static String[] oredictMetals;
public static void initialize(File configFile)
{
config = new Configuration(configFile);
@ -76,14 +80,16 @@ public class ConfigGeneral
depthsSWBiomeID = config.get(CATEGORY_GENERAL, "Biome ID for Depths Swamp Biome", biomeID++).getInt();
depthsTFBiomeID = config.get(CATEGORY_GENERAL, "Biome ID for Depths Tall Forest Biome", biomeID++).getInt();
depthsJBiomeID = config.get(CATEGORY_GENERAL, "Biome ID for Depths Jungle Biome", biomeID++).getInt();
}
catch(Exception e)
oredictMetals = config.getStringList(CATEGORY_GENERAL,
"List of oredictionary names of ingots/plates that the grindstone will be able to convert to dust",
new String[] { "Platinum", "Nickel", "Lead", "Silver", "" }, "");
} catch (Exception e)
{
LoggerSteamcraft.error("Failed to load configuration file:" + e);
}
finally
} finally
{
if(config.hasChanged())
if (config.hasChanged())
config.save();
}
}

View File

@ -12,6 +12,8 @@
*/
package steamcraft.common.init;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@ -27,6 +29,7 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
import boilerplate.common.utils.recipe.RecipeUtils;
import steamcraft.common.config.ConfigBalance;
import steamcraft.common.config.ConfigGeneral;
import steamcraft.common.lib.LibInfo;
/**
@ -155,6 +158,30 @@ public class InitRecipes
"plateIron", new ItemStack(InitItems.itemGrindstone, 1, OreDictionary.WILDCARD_VALUE)));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemVanillaPowder, ConfigBalance.numberOfDustsFromMetal, 1),
"plateGold", new ItemStack(InitItems.itemGrindstone, 1, OreDictionary.WILDCARD_VALUE)));
String[] oredictMetals = ConfigGeneral.oredictMetals;
for (int i = 0; i < oredictMetals.length; i++)
{
if (OreDictionary.doesOreNameExist("dust" + oredictMetals[i]))
{
ItemStack stack = null;
ArrayList<ItemStack> list = OreDictionary.getOres("dust" + oredictMetals[i]);
if (list.size() > 0)
stack = list.get(0);
if (OreDictionary.doesOreNameExist("ingot" + oredictMetals[i]))
{
GameRegistry.addRecipe(
new ShapelessOreRecipe(new ItemStack(stack.getItem(), ConfigBalance.numberOfDustsFromMetal, stack.getItemDamage()),
"ingot" + oredictMetals[i], new ItemStack(InitItems.itemGrindstone, 1, OreDictionary.WILDCARD_VALUE)));
}
if (OreDictionary.doesOreNameExist("plate" + oredictMetals[i]))
{
GameRegistry.addRecipe(
new ShapelessOreRecipe(new ItemStack(stack.getItem(), ConfigBalance.numberOfDustsFromMetal, stack.getItemDamage()),
"plate" + oredictMetals[i], new ItemStack(InitItems.itemGrindstone, 1, OreDictionary.WILDCARD_VALUE)));
}
}
}
}
private static void initToolsRecipes()