From 29aac5211f35e6f410c85600ff666a8e8202d0d2 Mon Sep 17 00:00:00 2001 From: oitsjustjose Date: Thu, 22 Oct 2015 11:44:06 -0400 Subject: [PATCH] Better Logging and Minor Refactors --- .../criss_cross/Items/ItemDust.java | 9 ++++-- .../criss_cross/Recipes/CRecipes.java | 13 ++++---- .../Recipes/CropomatorRecipes.java | 27 ++++++++++------ .../Recipes/ElectroextractorRecipes.java | 31 +++++++++++++------ .../Recipes/WoodchipperRecipes.java | 14 ++++++--- 5 files changed, 63 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/oitsjustjose/criss_cross/Items/ItemDust.java b/src/main/java/com/oitsjustjose/criss_cross/Items/ItemDust.java index 35eca75..9376240 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Items/ItemDust.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Items/ItemDust.java @@ -19,8 +19,8 @@ import net.minecraftforge.oredict.OreDictionary; public class ItemDust extends Item { - public static ArrayList dustNames = new ArrayList(); - public static ArrayList colors = new ArrayList(); + private static ArrayList dustNames = new ArrayList(); + private static ArrayList colors = new ArrayList(); public static IIcon overlay; public static IIcon base; @@ -31,6 +31,11 @@ public class ItemDust extends Item GameRegistry.registerItem(this, this.getUnlocalizedName()); } + public static ArrayList getDusts() + { + return dustNames; + } + public static void addDustType(String name, int color) { dustNames.add(name); diff --git a/src/main/java/com/oitsjustjose/criss_cross/Recipes/CRecipes.java b/src/main/java/com/oitsjustjose/criss_cross/Recipes/CRecipes.java index 2fc615b..64f7e2e 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Recipes/CRecipes.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Recipes/CRecipes.java @@ -37,8 +37,8 @@ public class CRecipes } else { - CCLog.warn("Item " + ConfigHandler.woodchipperRecipeItem + - "could not be added as part of the recipe of the Woodchipper. Please confirm you have the name and formatting correct."); + CCLog.warn("Item " + ConfigHandler.woodchipperRecipeItem + "could not be added as part of the recipe of the Woodchipper."); + CCLog.warn("Please confirm you have the name and formatting correct."); } GameRegistry.addRecipe(new ItemStack(CCBlocks.woodchipper), new Object[] @@ -65,8 +65,9 @@ public class CRecipes } else { - CCLog.warn("Item " + ConfigHandler.electroextractorRecipeItem + - " could not be added as part of the recipe of the electroextractor. Please confirm you have the name and formatting correct."); + CCLog.warn("Item " + ConfigHandler.electroextractorRecipeItem + " could not be added as part of the recipe of the electroextractor."); + CCLog.warn("Please confirm you have the name and formatting correct."); + } GameRegistry.addRecipe(new ItemStack(CCBlocks.electroextractor), new Object[] @@ -93,8 +94,8 @@ public class CRecipes } else { - CCLog.warn("Item " + ConfigHandler.cropomatorRecipeItem + - " could not be added as part of the recipe of the cropomator. Please confirm you have the name and formatting correct."); + CCLog.warn("Item " + ConfigHandler.cropomatorRecipeItem + " could not be added as part of the recipe of the cropomator."); + CCLog.warn("Please confirm you have the name and formatting correct."); } GameRegistry.addRecipe(new ItemStack(CCBlocks.cropomator), new Object[] diff --git a/src/main/java/com/oitsjustjose/criss_cross/Recipes/CropomatorRecipes.java b/src/main/java/com/oitsjustjose/criss_cross/Recipes/CropomatorRecipes.java index adb2fcc..6fd3a41 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Recipes/CropomatorRecipes.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Recipes/CropomatorRecipes.java @@ -22,8 +22,11 @@ public class CropomatorRecipes if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) TileEntityCropomator.addItemStackToOutputs(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1)); else - CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + - " could not be added to the Cropomator's recipe list. Please confirm you have the name and formatting correct."); + { + CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's recipe list."); + CCLog.warn("Please confirm you have the name and formatting correct."); + + } } if(unlocStack.length == 3) { @@ -33,8 +36,10 @@ public class CropomatorRecipes TileEntityCropomator.addItemStackToOutputs(newStack); } else - CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + - " could not be added to the Cropomator's recipe list. Please confirm you have the name and formatting correct."); + { + CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's recipe list."); + CCLog.warn("Please confirm you have the name and formatting correct."); + } } } @@ -58,8 +63,10 @@ public class CropomatorRecipes if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) TileEntityCropomator.addItemStackToCatalysts(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1)); else - CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + - " could not be added to the Cropomator's catalyst list. Please confirm you have the name and formatting correct."); + { + CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's catalyst list."); + CCLog.warn("Please confirm you have the name and formatting correct."); + } } if(unlocStack.length == 3) @@ -70,13 +77,15 @@ public class CropomatorRecipes TileEntityCropomator.addItemStackToCatalysts(newStack); } else - CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + - " could not be added to the Cropomator's catalyst list. Please confirm you have the name and formatting correct."); + { + CCLog.warn("Item " + ConfigHandler.cropomatorInputs[i] + " could not be added to the Cropomator's catalyst list."); + CCLog.warn("Please confirm you have the name and formatting correct."); + } } } catch(Exception e) { - CCLog.warn("[CrissCross]: Error reading itemstack for catalysts from input file at item: " + (i + 1)); + CCLog.warn("Error reading itemstack for catalysts from input file at item: " + (i + 1)); } } } diff --git a/src/main/java/com/oitsjustjose/criss_cross/Recipes/ElectroextractorRecipes.java b/src/main/java/com/oitsjustjose/criss_cross/Recipes/ElectroextractorRecipes.java index ead97d3..ff0ae7c 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Recipes/ElectroextractorRecipes.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Recipes/ElectroextractorRecipes.java @@ -27,6 +27,7 @@ public class ElectroextractorRecipes public static void oreDictionaryInit() { + ArrayList dustNames = ItemDust.getDusts(); for(int i = 0; i < ConfigHandler.electroextractorOreDictInputs.length; i++) { String[] entry = ConfigHandler.electroextractorOreDictInputs[i].split(":"); @@ -37,16 +38,24 @@ public class ElectroextractorRecipes for(int j = 0; j < ores.size(); j++) TileEntityElectroextractor.addRecipe(ores.get(j), new ItemStack(CCItems.dusts, 1, i)); } + else + { + CCLog.warn("Your oreDictionary Entry " + ConfigHandler.electroextractorOreDictInputs[i] + " could not be registered."); + if(!OreDictionary.doesOreNameExist("ore" + entry[0])) + CCLog.warn("This is because your oreDictionary Entry was not valid or registered as " + entry[0] + "."); + else if(!OreDictionary.doesOreNameExist("ingot" + entry[0])) + CCLog.warn("This is because your oreDictionary Entry does not have an ingot for " + entry[0] + "."); + } } - for(int i = 0; i < ItemDust.dustNames.size(); i++) + for(int i = 0; i < dustNames.size(); i++) { ItemStack ingot = null; - if(OreDictionary.doesOreNameExist("ingot" + ItemDust.dustNames.get(i))) - ingot = OreDictionary.getOres("ingot" + ItemDust.dustNames.get(i)).get(0); + if(OreDictionary.doesOreNameExist("ingot" + dustNames.get(i))) + ingot = OreDictionary.getOres("ingot" + dustNames.get(i)).get(0); if(ingot != null) GameRegistry.addSmelting(new ItemStack(CCItems.dusts, 1, i), ingot, 0.0F); - OreDictionary.registerOre("dust" + ItemDust.dustNames.get(i), new ItemStack(CCItems.dusts, 1, i)); + OreDictionary.registerOre("dust" + dustNames.get(i), new ItemStack(CCItems.dusts, 1, i)); } } @@ -62,8 +71,10 @@ public class ElectroextractorRecipes if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) TileEntityElectroextractor.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 0)); else - CCLog.warn("Item " + ConfigHandler.electroextractorEnergySources[i] + - " could not be added to the Electroextractor's fuel list. Please confirm you have the name and formatting correct."); + { + CCLog.warn("Item " + ConfigHandler.electroextractorEnergySources[i] + " could not be added to the Electroextractor's fuel list."); + CCLog.warn("Please confirm you have the name and formatting correct."); + } } if(unlocStack.length == 3) @@ -74,13 +85,15 @@ public class ElectroextractorRecipes TileEntityElectroextractor.addFuel(newStack); } else - CCLog.warn("Item " + ConfigHandler.electroextractorEnergySources[i] + - " could not be added to the Electroextractor's fuel list. Please confirm you have the name and formatting correct."); + { + CCLog.warn("Item " + ConfigHandler.electroextractorEnergySources[i] + " could not be added to the Electroextractor's fuel list."); + CCLog.warn("Please confirm you have the name and formatting correct."); + } } } catch(Exception e) { - CCLog.warn("[CrissCross]: Error reading itemstack for electroextractor's energy sources at item: " + (i + 1)); + CCLog.warn("Error reading itemstack for electroextractor's energy sources at item: " + (i + 1)); } } } diff --git a/src/main/java/com/oitsjustjose/criss_cross/Recipes/WoodchipperRecipes.java b/src/main/java/com/oitsjustjose/criss_cross/Recipes/WoodchipperRecipes.java index 95abf05..3a478f9 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/Recipes/WoodchipperRecipes.java +++ b/src/main/java/com/oitsjustjose/criss_cross/Recipes/WoodchipperRecipes.java @@ -63,8 +63,10 @@ public class WoodchipperRecipes if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) TileEntityWoodchipper.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 0)); else - CCLog.warn("Item " + ConfigHandler.woodchipperFuels[i] + - " could not be added to the Woodchipper's fuel list. Please confirm you have the name and formatting correct."); + { + CCLog.warn("Item " + ConfigHandler.woodchipperFuels[i] + " could not be added to the Woodchipper's fuel list."); + CCLog.warn("Please confirm you have the name and formatting correct."); + } } if(unlocStack.length == 3) @@ -75,13 +77,15 @@ public class WoodchipperRecipes TileEntityWoodchipper.addFuel(newStack); } else - CCLog.warn("Item " + ConfigHandler.woodchipperFuels[i] + - " could not be added to the Woodchipper's fuel list. Please confirm you have the name and formatting correct."); + { + CCLog.warn("Item " + ConfigHandler.woodchipperFuels[i] + " could not be added to the Woodchipper's fuel list."); + CCLog.warn("Please confirm you have the name and formatting correct."); + } } } catch(Exception e) { - CCLog.warn("[CrissCross]: Error reading itemstack for Woodchipper's energy sources at item: " + (i + 1)); + CCLog.warn("Error reading itemstack for Woodchipper's energy sources at item: " + (i + 1)); } } }