More work on the secondary P Stone, moved around some of the dynEMC stuff

This commit is contained in:
pahimar 2012-06-05 08:14:20 -04:00
parent 84b9c56b96
commit 8653295d44
6 changed files with 109 additions and 114 deletions

View file

@ -59,8 +59,8 @@ public class ConfigurationManager {
prop = config.getOrCreateBlockIdProperty("device", 179);
/* Item Ids */
prop = config.getOrCreateIntProperty("redStone", CATEGORY_ITEM, 27270);
RED_STONE = prop.getInt();
prop = config.getOrCreateIntProperty("miniumStone", CATEGORY_ITEM, 27270);
MINIUM_STONE = prop.getInt();
prop = config.getOrCreateIntProperty("philStone", CATEGORY_ITEM, 27271);
PHIL_STONE = prop.getInt();
prop = config.getOrCreateIntProperty("djinnRing", CATEGORY_ITEM, 27272);

View file

@ -1,26 +1,14 @@
package ee3.core;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import cpw.mods.fml.common.ReflectionHelper;
import ee3.item.ItemPhilosopherStone;
import ee3.item.ItemMiniumStone;
import ee3.item.ModItems;
import net.minecraft.src.Block;
import net.minecraft.src.CraftingManager;
import net.minecraft.src.FurnaceRecipes;
import net.minecraft.src.IRecipe;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.ModLoader;
import net.minecraft.src.ShapedRecipes;
import net.minecraft.src.ShapelessRecipes;
import net.minecraft.src.mod_EE3;
import static net.minecraft.src.Item.*;
import static net.minecraft.src.Block.*;
@ -33,6 +21,7 @@ import static net.minecraft.src.Block.*;
public class RecipesPhilStone {
private static ItemStack philStone = new ItemStack(ModItems.philStone, 1, -1);
private static ItemStack miniumStone = new ItemStack(ModItems.miniumStone, 1, -1);
private static ItemStack anyCoal = new ItemStack(coal, 1, -1);
private static ItemStack anyWood = new ItemStack(wood, 1, -1);
private static ItemStack anyPlank = new ItemStack(planks, 1, -1);
@ -40,9 +29,7 @@ public class RecipesPhilStone {
private static ItemStack dyeBoneMeal = new ItemStack(dyePowder, 1, 15);
public static void initRecipes() {
//determineBaseMaterials();
initTransmutationRecipes();
initEquivalenceRecipes();
initReconstructiveRecipes();
@ -50,67 +37,6 @@ public class RecipesPhilStone {
initPortableSmeltingRecipes();
}
public static void determineBaseMaterials() {
CraftingManager instance = CraftingManager.getInstance();
List recipeList = instance.getRecipeList();
IRecipe recipe;
ShapedRecipes shapedRecipe;
ShapelessRecipes shapelessRecipe;
ItemStack[] shapedInputs;
List<ItemStack> shapelessInputs;
ItemStack recipeOutput = null;
Iterator<IRecipe> recipeIter = recipeList.iterator();
ItemStack[] recipeInputs = null;
Vector<Integer> inputs = new Vector<Integer>();
Vector<Integer> outputs = new Vector<Integer>();
try {
while (recipeIter.hasNext()) {
recipe = recipeIter.next();
if (recipe instanceof ShapedRecipes) {
shapedRecipe = (ShapedRecipes) recipe;
//shapedInputs = mod_EE3.proxy.getPrivateValue(ShapedRecipes.class, shapedRecipe, "recipeItems");
recipeInputs = ReflectionHelper.getPrivateValue(ShapedRecipes.class, shapedRecipe, "recipeItems");
recipeOutput = ReflectionHelper.getPrivateValue(ShapedRecipes.class, shapedRecipe, "recipeOutput");
System.out.println("Shaped Recipe");
}
else if (recipe instanceof ShapelessRecipes) {
shapelessRecipe = (ShapelessRecipes) recipe;
shapelessInputs = ReflectionHelper.getPrivateValue(ShapelessRecipes.class, shapelessRecipe, "recipeItems");
recipeInputs = shapelessInputs.toArray(new ItemStack[0]);
recipeOutput = ReflectionHelper.getPrivateValue(ShapelessRecipes.class, shapelessRecipe, "recipeOutput");
System.out.println("Shapeless Recipe");
}
System.out.println("Output: " + recipeOutput.toString());
outputs.add(recipeOutput.getItem().shiftedIndex);
for (ItemStack itemStack : recipeInputs) {
if (itemStack != null) {
System.out.println("Input: " + itemStack.toString());
if (!inputs.contains(new Integer(itemStack.getItem().shiftedIndex)))
inputs.add(new Integer(itemStack.getItem().shiftedIndex));
}
}
System.out.println();
}
//for (int i = 0; i < outputs.size(); i++) {
// System.out.println("i: " + i + ", item: " + outputs.get(i));
//}
inputs.removeAll(outputs);
for (int i = 0; i < inputs.size(); i++) {
System.out.println(i + "," + inputs.get(i) + "," + Item.itemsList[inputs.get(i)].getItemName());
}
}
catch (Exception e) {
e.printStackTrace(System.err);
}
}
public static void initTransmutationRecipes() {
/* 4 Cobble <-> 1 Flint */
addRecipe(flint, philStone, cobblestone, cobblestone, cobblestone, cobblestone);

View file

@ -1,10 +1,18 @@
package ee3.emc;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import net.minecraft.src.Block;
import net.minecraft.src.CraftingManager;
import net.minecraft.src.IRecipe;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.ModLoader;
import net.minecraft.src.ShapedRecipes;
import net.minecraft.src.ShapelessRecipes;
public class EMCList {
@ -15,12 +23,73 @@ public class EMCList {
}
public void initEMCList() {
determineBaseMaterials();
}
/* Helper functions */
private static void determineBaseMaterials() {
CraftingManager instance = CraftingManager.getInstance();
List recipeList = instance.getRecipeList();
IRecipe recipe;
ShapedRecipes shapedRecipe;
ShapelessRecipes shapelessRecipe;
ItemStack[] shapedInputs;
List<ItemStack> shapelessInputs;
ItemStack recipeOutput = null;
Iterator<IRecipe> recipeIter = recipeList.iterator();
ItemStack[] recipeInputs = null;
Vector<Integer> inputs = new Vector<Integer>();
Vector<Integer> outputs = new Vector<Integer>();
try {
while (recipeIter.hasNext()) {
recipe = recipeIter.next();
if (recipe instanceof ShapedRecipes) {
shapedRecipe = (ShapedRecipes) recipe;
//shapedInputs = mod_EE3.proxy.getPrivateValue(ShapedRecipes.class, shapedRecipe, "recipeItems");
recipeInputs = ModLoader.getPrivateValue(ShapedRecipes.class, shapedRecipe, "recipeItems");
recipeOutput = ModLoader.getPrivateValue(ShapedRecipes.class, shapedRecipe, "recipeOutput");
System.out.println("Shaped Recipe");
}
else if (recipe instanceof ShapelessRecipes) {
shapelessRecipe = (ShapelessRecipes) recipe;
shapelessInputs = ModLoader.getPrivateValue(ShapelessRecipes.class, shapelessRecipe, "recipeItems");
recipeInputs = shapelessInputs.toArray(new ItemStack[0]);
recipeOutput = ModLoader.getPrivateValue(ShapelessRecipes.class, shapelessRecipe, "recipeOutput");
System.out.println("Shapeless Recipe");
}
System.out.println("Output: " + recipeOutput.toString());
outputs.add(recipeOutput.getItem().shiftedIndex);
for (ItemStack itemStack : recipeInputs) {
if (itemStack != null) {
System.out.println("Input: " + itemStack.toString());
if (!inputs.contains(new Integer(itemStack.getItem().shiftedIndex)))
inputs.add(new Integer(itemStack.getItem().shiftedIndex));
}
}
System.out.println();
}
//for (int i = 0; i < outputs.size(); i++) {
// System.out.println("i: " + i + ", item: " + outputs.get(i));
//}
inputs.removeAll(outputs);
for (int i = 0; i < inputs.size(); i++) {
System.out.println(i + "," + inputs.get(i) + "," + Item.itemsList[inputs.get(i)].getItemName());
}
}
catch (Exception e) {
e.printStackTrace(System.err);
}
}
private void printEMCList() {
System.out.println("\n*** Starting Debug Dump of EMC List ***");
System.out.println("*** End of EMC List ***\n");

View file

@ -5,11 +5,11 @@ import net.minecraft.src.ItemStack;
import net.minecraft.src.mod_EE3;
import ee3.lib.CustomItemRarity;
public class ItemRedStone extends ItemEE {
public class ItemMiniumStone extends ItemEE {
// Possible names: Vermillion Stone, Minium Stone, Red Stone
public ItemRedStone(int i) {
public ItemMiniumStone(int i) {
super(i);
}

View file

@ -15,7 +15,7 @@ public class ModItems {
private static boolean initialized;
public static Item redStone;
public static Item miniumStone;
public static Item philStone;
public static void init() {
@ -23,18 +23,18 @@ public class ModItems {
initialized = true;
/* Initialise each mod item individually */
redStone = new ItemRedStone(ItemIds.RED_STONE).setIconCoord(0, 0).setItemName("redStone");
miniumStone = new ItemMiniumStone(ItemIds.MINIUM_STONE).setIconCoord(0, 0).setItemName("miniumStone");
philStone = new ItemPhilosopherStone(ItemIds.PHIL_STONE).setIconCoord(1, 0).setItemName("philStone");
/* Set the Container items for our mod items */
redStone.setContainerItem(redStone);
miniumStone.setContainerItem(miniumStone);
philStone.setContainerItem(philStone);
/* Add the item names to the mod items */
ModLoader.addName(redStone, "Red Stone");
ModLoader.addName(miniumStone, "Minium Stone");
ModLoader.addName(philStone, "Philosopher's Stone");
ModLoader.addShapelessRecipe(new ItemStack(redStone), Block.dirt);
ModLoader.addShapelessRecipe(new ItemStack(miniumStone), Block.dirt);
ModLoader.addShapelessRecipe(new ItemStack(philStone), Block.dirt, Block.dirt);
}
}

View file

@ -6,7 +6,7 @@ package ee3.lib;
*
*/
public class ItemIds {
public static int RED_STONE = 27270;
public static int MINIUM_STONE = 27270;
public static int PHIL_STONE = 27271;
public static int DJINN_RING;
public static int EYE_OF_THE_VOID;