Fixed #268 - Recipe issues

This commit is contained in:
Calclavia 2014-02-24 20:40:58 +08:00
parent 10f60b59cc
commit 5118106f9d
4 changed files with 19 additions and 6 deletions

View file

@ -1,5 +1,7 @@
package resonantinduction.archaic.process;
import java.util.Map.Entry;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;

View file

@ -173,6 +173,7 @@ public class Mechanical
GameRegistry.addRecipe(new ShapedOreRecipe(blockTank, "GGG", "GSG", "GGG", 'G', Block.glass, 'S', Item.ingotIron));
GameRegistry.addRecipe(new ShapedOreRecipe(blockGrate, "BBB", "B B", "BBB", 'B', Block.fenceIron));
GameRegistry.addRecipe(new ShapedOreRecipe(blockPump, "PPP", "GGG", "PPP", 'P', itemPipe, 'G', itemGear));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemPipe, 4), "BBB", " ", "BBB", 'B', UniversalRecipe.SECONDARY_METAL.get()));
GameRegistry.addRecipe(new ShapedOreRecipe(itemPipeGuage, "RRR", "GGG", " S ", 'S', Item.stick, 'G', Block.glass, 'R', Item.redstone));

View file

@ -69,7 +69,7 @@ public abstract class RecipeResource
{
return itemStack.copy();
}
@Override
public String toString()
{
@ -108,8 +108,11 @@ public abstract class RecipeResource
if (obj instanceof ItemStackResource)
{
return OreDictionary.getOres(name).contains(((ItemStackResource) obj).itemStack);
for (ItemStack is : OreDictionary.getOres(name).toArray(new ItemStack[0]))
if (is.isItemEqual(((ItemStackResource) obj).itemStack))
return true;
}
if (obj instanceof ItemStack)
{
for (ItemStack is : OreDictionary.getOres(name).toArray(new ItemStack[0]))
@ -126,7 +129,7 @@ public abstract class RecipeResource
{
return OreDictionary.getOres(name).get(0).copy();
}
@Override
public String toString()
{

View file

@ -45,6 +45,12 @@ public class ResourceGenerator
{
public static final ResourceGenerator INSTANCE = new ResourceGenerator();
public static final Set<String> oreDictBlackList = new HashSet<String>();
/**
* A list of material names. They are all camelCase reference of ore dictionary names without
* the
* "ore" or "ingot" prefix.
*/
public static final List<String> materialNames = new ArrayList<String>();
public static final HashMap<String, Integer> materialColors = new HashMap<String, Integer>();
private static final HashMap<Icon, Integer> iconColorMap = new HashMap<Icon, Integer>();
@ -59,15 +65,16 @@ public class ResourceGenerator
{
if (evt.Name.startsWith("ingot") && !oreDictBlackList.contains(evt.Name))
{
String materialName = evt.Name.replace("ingot", "");
String oreDictName = evt.Name.replace("ingot", "");
String materialName = LanguageUtility.decapitalizeFirst(oreDictName);
if (!materialNames.contains(materialName))
{
Settings.CONFIGURATION.load();
boolean allowMaterial = Settings.CONFIGURATION.get("Resource_Generator", "Enable " + materialName, true).getBoolean(true);
boolean allowMaterial = Settings.CONFIGURATION.get("Resource_Generator", "Enable " + oreDictName, true).getBoolean(true);
Settings.CONFIGURATION.save();
if (!allowMaterial && OreDetectionBlackList.isIngotBlackListed("ingot" + materialName) || OreDetectionBlackList.isOreBlackListed("ore" + materialName))
if (!allowMaterial && OreDetectionBlackList.isIngotBlackListed("ingot" + oreDictName) || OreDetectionBlackList.isOreBlackListed("ore" + oreDictName))
return;
materialNames.add(materialName);