aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r--src/Java/gtPlusPlus/core/item/general/chassis/itemDehydratorCoilMeta.java74
-rw-r--r--src/Java/gtPlusPlus/core/item/general/chassis/itemDehydratorCoilWireMeta.java76
-rw-r--r--src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java82
3 files changed, 201 insertions, 31 deletions
diff --git a/src/Java/gtPlusPlus/core/item/general/chassis/itemDehydratorCoilMeta.java b/src/Java/gtPlusPlus/core/item/general/chassis/itemDehydratorCoilMeta.java
new file mode 100644
index 0000000000..a743604547
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/general/chassis/itemDehydratorCoilMeta.java
@@ -0,0 +1,74 @@
+public class itemDehydratorCoil extends Item {
+
+ public IIcon[] icon = new IIcon[1];
+
+ public itemDehydratorCoil() {
+ super();
+ this.setHasSubtypes(true);
+ String unlocalizedName = "itemDehydratorCoil";
+ this.setUnlocalizedName(unlocalizedName);
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "itemDehydratorCoil");
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int meta) {
+ return this.icons[0];
+ }
+
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 4; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return this.getUnlocalizedName() + "_" + stack.getItemDamage();
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ String itemName = "Dehydrator Coil";
+ String suffixName = "";
+ if (tItem.getItemDamage() == 0){
+ suffixName = " [EV]";
+ }
+ else if (tItem.getItemDamage() == 1){
+ suffixName = " [IV]";
+ }
+ else if (tItem.getItemDamage() == 2){
+ suffixName = " [LuV]";
+ }
+ else if (tItem.getItemDamage() == 3){
+ suffixName = " [ZPM]";
+ }
+ return (itemName+suffixName);
+
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) {
+ int meta = stack.getItemDamage();
+ if (meta == 0){
+ HEX_OxFFFFFF = Utils.rgbToHex(10,110,30);
+ }
+ else if (meta == 1){
+ HEX_OxFFFFFF = Utils.rgbToHex(150,180,35);
+ }
+ else if (meta == 2){
+ HEX_OxFFFFFF = Utils.rgbToHex(200,85,40);
+ }
+ else if (meta == 3){
+ HEX_OxFFFFFF = Utils.rgbToHex(255,100,50);
+ }
+ return HEX_OxFFFFFF;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/general/chassis/itemDehydratorCoilWireMeta.java b/src/Java/gtPlusPlus/core/item/general/chassis/itemDehydratorCoilWireMeta.java
new file mode 100644
index 0000000000..8a59421b56
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/general/chassis/itemDehydratorCoilWireMeta.java
@@ -0,0 +1,76 @@
+package com.bedrockminer.tutorial.item;
+
+public class itemDehydratorCoilWire extends Item {
+
+ public IIcon[] icon = new IIcon[1];
+
+ public itemDehydratorCoilWire() {
+ super();
+ this.setHasSubtypes(true);
+ String unlocalizedName = "itemDehydratorCoilWire";
+ this.setUnlocalizedName(unlocalizedName);
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "itemDehydratorCoilWire");
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int meta) {
+ return this.icons[0];
+ }
+
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 4; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return this.getUnlocalizedName() + "_" + stack.getItemDamage();
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ String itemName = "Coil Wire";
+ String suffixName = "";
+ if (tItem.getItemDamage() == 0){
+ suffixName = " [EV]";
+ }
+ else if (tItem.getItemDamage() == 1){
+ suffixName = " [IV]";
+ }
+ else if (tItem.getItemDamage() == 2){
+ suffixName = " [LuV]";
+ }
+ else if (tItem.getItemDamage() == 3){
+ suffixName = " [ZPM]";
+ }
+ return (itemName+suffixName);
+
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) {
+ int meta = stack.getItemDamage();
+ if (meta == 0){
+ HEX_OxFFFFFF = Utils.rgbToHex(10,110,30);
+ }
+ else if (meta == 1){
+ HEX_OxFFFFFF = Utils.rgbToHex(150,180,35);
+ }
+ else if (meta == 2){
+ HEX_OxFFFFFF = Utils.rgbToHex(200,85,40);
+ }
+ else if (meta == 3){
+ HEX_OxFFFFFF = Utils.rgbToHex(255,100,50);
+ }
+ return HEX_OxFFFFFF;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java
index e19332e4a9..6c80dc4a1d 100644
--- a/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java
+++ b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java
@@ -330,38 +330,58 @@ public class RecipeUtils {
final Object InputItem7, final Object InputItem8, final Object InputItem9,
final ItemStack OutputItem){
- if ((!(InputItem1 instanceof ItemStack) && !(InputItem1 instanceof String) && (InputItem1 != null)) ||
- (!(InputItem2 instanceof ItemStack) && !(InputItem2 instanceof String) && (InputItem2 != null)) ||
- (!(InputItem3 instanceof ItemStack) && !(InputItem3 instanceof String) && (InputItem3 != null)) ||
- (!(InputItem4 instanceof ItemStack) && !(InputItem4 instanceof String) && (InputItem4 != null)) ||
- (!(InputItem5 instanceof ItemStack) && !(InputItem5 instanceof String) && (InputItem5 != null)) ||
- (!(InputItem6 instanceof ItemStack) && !(InputItem6 instanceof String) && (InputItem6 != null)) ||
- (!(InputItem7 instanceof ItemStack) && !(InputItem7 instanceof String) && (InputItem7 != null)) ||
- (!(InputItem8 instanceof ItemStack) && !(InputItem8 instanceof String) && (InputItem8 != null)) ||
- (!(InputItem9 instanceof ItemStack) && !(InputItem9 instanceof String) && (InputItem9 != null))){
- Utils.LOG_INFO("One Input item was not an ItemStack of an OreDict String.");
- return false;
- }
+ Object[] o = {
+ InputItem1, InputItem2, InputItem3,
+ InputItem4, InputItem5, InputItem6,
+ InputItem7, InputItem8, InputItem9
+ };
+
+ if (addShapedGregtechRecipe(o, OutputItem)){
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
- if (GT_ModHandler.addCraftingRecipe(OutputItem,
- GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE |
- GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED,
- new Object[]{"ABC", "DEF", "GHI",
- 'A', InputItem1,
- 'B', InputItem2,
- 'C', InputItem3,
- 'D', InputItem4,
- 'E', InputItem5,
- 'F', InputItem6,
- 'G', InputItem7,
- 'H', InputItem8,
- 'I', InputItem9})){
- Utils.LOG_INFO("Success! Added a recipe for "+OutputItem.getDisplayName());
- RegistrationHandler.recipesSuccess++;
- return true;
- }
- return false;
- }
+ public static boolean addShapedGregtechRecipe(final Object[] inputs, final ItemStack output){
+
+ if (inputs.length != 9){
+ Utils.LOG_INFO("Input array for "+output.getDisplayName()+" does not equal 9.");
+ return false;
+ }
+
+ for (int x=0;x<9;x++){
+ if (inputs[x] == null){
+ inputs[x] = " ";
+ }
+ if (!(inputs[x] instanceof ItemStack) || !(inputs[x] instanceof String)){
+ Utils.LOG_INFO("Invalid Item inserted into inputArray. Item:"+output.getDisplayName()+" has a bad recipe. Please report to Alkalus.");
+ }
+ }
+
+ if (GT_ModHandler.addCraftingRecipe(output,
+ GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE |
+ GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED,
+ new Object[]{"ABC", "DEF", "GHI",
+ 'A', inputs[0],
+ 'B', inputs[1],
+ 'C', inputs[2],
+ 'D', inputs[3],
+ 'E', inputs[4],
+ 'F', inputs[5],
+ 'G', inputs[6],
+ 'H', inputs[7],
+ 'I', inputs[8]})){
+ Utils.LOG_INFO("Success! Added a recipe for "+output.getDisplayName());
+ RegistrationHandler.recipesSuccess++;
+ return true;
+ }
+ else {
+ Utils.LOG_INFO("Failed to add recipe for "+output.getDisplayName()+". Please report to Alkalus.");
+ return false;
+ }
+ }
public static void addShapelessGregtechRecipe(final ItemStack OutputItem, final Object... inputItems){