2022-11-09 22:15:45 +01:00
|
|
|
package calclavia.lib;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
2022-11-09 22:16:55 +01:00
|
|
|
|
|
|
|
import cpw.mods.fml.common.FMLLog;
|
2022-11-09 22:15:45 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraftforge.oredict.OreDictionary;
|
|
|
|
|
|
|
|
public class UniversalRecipes {
|
2022-11-09 22:16:55 +01:00
|
|
|
public static final String PRIMARY_METAL = "ingotSteel";
|
|
|
|
public static final String PRIMARY_PLATE = "plateSteel";
|
|
|
|
public static final String SECONDARY_METAL = "ingotBronze";
|
|
|
|
public static final String SECONDARY_PLATE = "plateBronze";
|
2022-12-18 17:30:44 +01:00
|
|
|
public static final String CIRCUIT_T1 = "circuitBasic";
|
|
|
|
public static final String CIRCUIT_T2 = "circuitAdvanced";
|
|
|
|
public static final String CIRCUIT_T3 = "circuitElite";
|
2022-11-09 22:16:55 +01:00
|
|
|
public static String ADVANCED_BATTERY = "calclavia:ADVANCED_BATTERY";
|
|
|
|
public static String BATTERY = "calclavia:BATTERY";
|
|
|
|
public static String BATTERY_BOX = "calclavia:BATTERY_BOX";
|
|
|
|
public static final String WRENCH = "calclavia:WRENCH";
|
2022-12-18 17:30:44 +01:00
|
|
|
public static final String WIRE = "copperWire";
|
|
|
|
public static final String MOTOR = "motor";
|
2022-11-09 22:16:55 +01:00
|
|
|
public static boolean isInit = false;
|
2022-11-09 22:15:45 +01:00
|
|
|
|
2022-11-09 22:16:55 +01:00
|
|
|
public static void init() {
|
|
|
|
if (!isInit) {
|
|
|
|
// TODO: WTF
|
2022-12-18 17:30:44 +01:00
|
|
|
// register("circuitBasic", new Object[]{"circuitBasic",
|
2022-11-09 22:16:55 +01:00
|
|
|
// Items.getItem("electronicCircuit"), new
|
2022-12-18 17:30:44 +01:00
|
|
|
// ItemStack(Blocks.redstone_torch)}); register("circuitAdvanced",
|
2022-11-09 22:16:55 +01:00
|
|
|
// new Object[]{"circuitAdvanced", Items.getItem("advancedCircuit"), new
|
2022-12-18 17:30:44 +01:00
|
|
|
// ItemStack(Items.repeater)}); register("circuitElite", new
|
2022-11-09 22:16:55 +01:00
|
|
|
// Object[]{"circuitElite", Items.getItem("iridiumPlate"), new
|
|
|
|
// ItemStack(Block.field_94346_cn)}); register(ADVANCED_BATTERY, new
|
|
|
|
// Object[]{"advancedBattery", Items.getItem("energyCrystal"), "battery",
|
|
|
|
// new ItemStack(Items.repeater)}); register(BATTERY, new
|
|
|
|
// Object[]{"battery", Items.getItem("reBattery"), new
|
|
|
|
// ItemStack(Items.repeater)});
|
|
|
|
// register(BATTERY_BOX, new Object[]{"batteryBox",
|
|
|
|
// Items.getItem("batBox"), new ItemStack(Block.field_72105_ah)});
|
|
|
|
// register("calclavia:WRENCH", new Object[]{"wrench",
|
|
|
|
// Items.getItem("wrench"), new ItemStack(Item.field_77708_h)});
|
2022-12-18 17:30:44 +01:00
|
|
|
// register("copperWire", new Object[]{"copperWire",
|
2022-11-09 22:16:55 +01:00
|
|
|
// "copperCableBlock", new ItemStack(Item.field_77767_aC)});
|
2022-12-18 17:30:44 +01:00
|
|
|
// register("motor", new Object[]{"motor",
|
2022-11-09 22:16:55 +01:00
|
|
|
// Items.getItem("generator"), new ItemStack(Block.field_71963_Z)});
|
|
|
|
isInit = true;
|
|
|
|
}
|
2022-11-09 22:15:45 +01:00
|
|
|
}
|
|
|
|
|
2022-11-09 22:16:55 +01:00
|
|
|
public static void register(String name, Object... possiblities) {
|
|
|
|
Object[] arr$ = possiblities;
|
|
|
|
int len$ = possiblities.length;
|
2022-11-09 22:15:45 +01:00
|
|
|
|
2022-11-09 22:16:55 +01:00
|
|
|
for (int i$ = 0; i$ < len$; ++i$) {
|
|
|
|
Object possiblity = arr$[i$];
|
|
|
|
|
|
|
|
if (possiblity instanceof ItemStack) {
|
|
|
|
if (registerItemStacksToDictionary(
|
|
|
|
name, new ItemStack[] { (ItemStack) possiblity }
|
|
|
|
)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if (possiblity instanceof String) {
|
|
|
|
if (registerItemStacksToDictionary(name, (String) possiblity)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
FMLLog.severe(
|
|
|
|
"Universal Recipes: Error Registering " + name, new Object[0]
|
|
|
|
);
|
|
|
|
}
|
2022-11-09 22:15:45 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-09 22:16:55 +01:00
|
|
|
public static boolean registerItemStacksToDictionary(String name, List itemStacks) {
|
|
|
|
boolean returnValue = false;
|
2022-11-09 22:15:45 +01:00
|
|
|
|
2022-11-09 22:16:55 +01:00
|
|
|
if (itemStacks != null && itemStacks.size() > 0) {
|
|
|
|
Iterator i$ = itemStacks.iterator();
|
|
|
|
|
|
|
|
while (i$.hasNext()) {
|
|
|
|
ItemStack stack = (ItemStack) i$.next();
|
|
|
|
|
|
|
|
if (stack != null) {
|
|
|
|
OreDictionary.registerOre(name, stack);
|
|
|
|
returnValue = true;
|
|
|
|
}
|
|
|
|
}
|
2022-11-09 22:15:45 +01:00
|
|
|
}
|
|
|
|
|
2022-11-09 22:16:55 +01:00
|
|
|
return returnValue;
|
|
|
|
}
|
2022-11-09 22:15:45 +01:00
|
|
|
|
2022-11-09 22:16:55 +01:00
|
|
|
public static boolean
|
|
|
|
registerItemStacksToDictionary(String name, ItemStack... itemStacks) {
|
|
|
|
return registerItemStacksToDictionary(name, Arrays.asList(itemStacks));
|
|
|
|
}
|
2022-11-09 22:15:45 +01:00
|
|
|
|
2022-11-09 22:16:55 +01:00
|
|
|
public static boolean registerItemStacksToDictionary(String name, String stackName) {
|
|
|
|
return registerItemStacksToDictionary(
|
|
|
|
name, (List) OreDictionary.getOres(stackName)
|
|
|
|
);
|
|
|
|
}
|
2022-11-09 22:15:45 +01:00
|
|
|
}
|