Better Logging and Minor Refactors

This commit is contained in:
oitsjustjose 2015-10-22 11:44:06 -04:00
commit 29aac5211f
5 changed files with 63 additions and 31 deletions

View file

@ -19,8 +19,8 @@ import net.minecraftforge.oredict.OreDictionary;
public class ItemDust extends Item public class ItemDust extends Item
{ {
public static ArrayList<String> dustNames = new ArrayList<String>(); private static ArrayList<String> dustNames = new ArrayList<String>();
public static ArrayList<Integer> colors = new ArrayList<Integer>(); private static ArrayList<Integer> colors = new ArrayList<Integer>();
public static IIcon overlay; public static IIcon overlay;
public static IIcon base; public static IIcon base;
@ -31,6 +31,11 @@ public class ItemDust extends Item
GameRegistry.registerItem(this, this.getUnlocalizedName()); GameRegistry.registerItem(this, this.getUnlocalizedName());
} }
public static ArrayList<String> getDusts()
{
return dustNames;
}
public static void addDustType(String name, int color) public static void addDustType(String name, int color)
{ {
dustNames.add(name); dustNames.add(name);

View file

@ -37,8 +37,8 @@ public class CRecipes
} }
else else
{ {
CCLog.warn("Item " + ConfigHandler.woodchipperRecipeItem + CCLog.warn("Item " + ConfigHandler.woodchipperRecipeItem + "could not be added as part of the recipe of the Woodchipper.");
"could not be added as part of the recipe of the Woodchipper. Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
GameRegistry.addRecipe(new ItemStack(CCBlocks.woodchipper), new Object[] GameRegistry.addRecipe(new ItemStack(CCBlocks.woodchipper), new Object[]
@ -65,8 +65,9 @@ public class CRecipes
} }
else else
{ {
CCLog.warn("Item " + ConfigHandler.electroextractorRecipeItem + CCLog.warn("Item " + ConfigHandler.electroextractorRecipeItem + " could not be added as part of the recipe of the electroextractor.");
" could not be added as part of the recipe of the electroextractor. Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
GameRegistry.addRecipe(new ItemStack(CCBlocks.electroextractor), new Object[] GameRegistry.addRecipe(new ItemStack(CCBlocks.electroextractor), new Object[]
@ -93,8 +94,8 @@ public class CRecipes
} }
else else
{ {
CCLog.warn("Item " + ConfigHandler.cropomatorRecipeItem + CCLog.warn("Item " + ConfigHandler.cropomatorRecipeItem + " could not be added as part of the recipe of the cropomator.");
" could not be added as part of the recipe of the cropomator. Please confirm you have the name and formatting correct."); CCLog.warn("Please confirm you have the name and formatting correct.");
} }
GameRegistry.addRecipe(new ItemStack(CCBlocks.cropomator), new Object[] GameRegistry.addRecipe(new ItemStack(CCBlocks.cropomator), new Object[]

View file

@ -22,8 +22,11 @@ public class CropomatorRecipes
if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
TileEntityCropomator.addItemStackToOutputs(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1)); TileEntityCropomator.addItemStackToOutputs(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1));
else 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) if(unlocStack.length == 3)
{ {
@ -33,8 +36,10 @@ public class CropomatorRecipes
TileEntityCropomator.addItemStackToOutputs(newStack); TileEntityCropomator.addItemStackToOutputs(newStack);
} }
else 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) if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
TileEntityCropomator.addItemStackToCatalysts(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1)); TileEntityCropomator.addItemStackToCatalysts(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1));
else 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) if(unlocStack.length == 3)
@ -70,13 +77,15 @@ public class CropomatorRecipes
TileEntityCropomator.addItemStackToCatalysts(newStack); TileEntityCropomator.addItemStackToCatalysts(newStack);
} }
else 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) 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));
} }
} }
} }

View file

@ -27,6 +27,7 @@ public class ElectroextractorRecipes
public static void oreDictionaryInit() public static void oreDictionaryInit()
{ {
ArrayList<String> dustNames = ItemDust.getDusts();
for(int i = 0; i < ConfigHandler.electroextractorOreDictInputs.length; i++) for(int i = 0; i < ConfigHandler.electroextractorOreDictInputs.length; i++)
{ {
String[] entry = ConfigHandler.electroextractorOreDictInputs[i].split(":"); String[] entry = ConfigHandler.electroextractorOreDictInputs[i].split(":");
@ -37,16 +38,24 @@ public class ElectroextractorRecipes
for(int j = 0; j < ores.size(); j++) for(int j = 0; j < ores.size(); j++)
TileEntityElectroextractor.addRecipe(ores.get(j), new ItemStack(CCItems.dusts, 1, i)); 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; ItemStack ingot = null;
if(OreDictionary.doesOreNameExist("ingot" + ItemDust.dustNames.get(i))) if(OreDictionary.doesOreNameExist("ingot" + dustNames.get(i)))
ingot = OreDictionary.getOres("ingot" + ItemDust.dustNames.get(i)).get(0); ingot = OreDictionary.getOres("ingot" + dustNames.get(i)).get(0);
if(ingot != null) if(ingot != null)
GameRegistry.addSmelting(new ItemStack(CCItems.dusts, 1, i), ingot, 0.0F); 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) if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
TileEntityElectroextractor.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 0)); TileEntityElectroextractor.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 0));
else 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) if(unlocStack.length == 3)
@ -74,13 +85,15 @@ public class ElectroextractorRecipes
TileEntityElectroextractor.addFuel(newStack); TileEntityElectroextractor.addFuel(newStack);
} }
else 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) 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));
} }
} }
} }

View file

@ -63,8 +63,10 @@ public class WoodchipperRecipes
if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null) if(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 1) != null)
TileEntityWoodchipper.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 0)); TileEntityWoodchipper.addFuel(GameRegistry.findItemStack(unlocStack[0], unlocStack[1], 0));
else 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) if(unlocStack.length == 3)
@ -75,13 +77,15 @@ public class WoodchipperRecipes
TileEntityWoodchipper.addFuel(newStack); TileEntityWoodchipper.addFuel(newStack);
} }
else 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) 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));
} }
} }
} }