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 static ArrayList<String> dustNames = new ArrayList<String>();
public static ArrayList<Integer> colors = new ArrayList<Integer>();
private static ArrayList<String> dustNames = new ArrayList<String>();
private static ArrayList<Integer> colors = new ArrayList<Integer>();
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<String> getDusts()
{
return dustNames;
}
public static void addDustType(String name, int color)
{
dustNames.add(name);

View file

@ -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[]

View file

@ -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));
}
}
}

View file

@ -27,6 +27,7 @@ public class ElectroextractorRecipes
public static void oreDictionaryInit()
{
ArrayList<String> 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));
}
}
}

View file

@ -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));
}
}
}