Better error logging
This commit is contained in:
parent
9f61304258
commit
eef4c19a47
|
@ -37,7 +37,7 @@ public class ReflectionHelper {
|
|||
Constructor<?> constructor = clazz.getDeclaredConstructor(argumentTypes);
|
||||
constructor.setAccessible(true);
|
||||
return constructor;
|
||||
} catch (Exception ex) { LogHelper.logError("Exception getting constructore of " + className, ex); }
|
||||
} catch (Exception ex) { LogHelper.logError("Exception getting constructor of " + className, ex); }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -76,6 +76,8 @@ public class ReflectionHelper {
|
|||
} catch (Exception ex) {}
|
||||
}
|
||||
|
||||
LogHelper.logError("Could not retrieve any object for the provided field names.");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -100,6 +102,8 @@ public class ReflectionHelper {
|
|||
} catch (Exception ex) {}
|
||||
}
|
||||
|
||||
LogHelper.logError("Could not retrieve any final object for the provided field names.");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -118,6 +122,8 @@ public class ReflectionHelper {
|
|||
return (T) result.get(null);
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
LogHelper.logError("Could not retrieve any static object for the provided field names.");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -134,6 +140,8 @@ public class ReflectionHelper {
|
|||
return getStaticObject(clazz, fieldNames);
|
||||
} catch (ClassNotFoundException e) { }
|
||||
|
||||
LogHelper.logError("Could not retrieve any static object for the provided field names.");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,13 @@ public class Crucible {
|
|||
return;
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(ReflectionHelper.getInstance(ThermalHelper.crucibleRecipe, toStack(input), toFluid(output), energy)));
|
||||
RecipeCrucible recipe = ReflectionHelper.getInstance(ThermalHelper.crucibleRecipe, toStack(input), toFluid(output), energy);
|
||||
|
||||
if(recipe != null) {
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error while creating instance for %s recipe.", name));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipeCrucible> {
|
||||
|
|
|
@ -41,7 +41,13 @@ public class Furnace {
|
|||
return;
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(ReflectionHelper.getInstance(ThermalHelper.furanceRecipe, toStack(input), toStack(output), energy)));
|
||||
RecipeFurnace recipe = ReflectionHelper.getInstance(ThermalHelper.furanceRecipe, toStack(input), toStack(output), energy);
|
||||
|
||||
if(recipe != null) {
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error while creating instance for %s recipe.", name));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipeFurnace> {
|
||||
|
|
|
@ -46,7 +46,13 @@ public class Pulverizer {
|
|||
return;
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(ReflectionHelper.getInstance(ThermalHelper.pulverizerRecipe, toStack(input), toStack(output), toStack(secondary), secondaryChance, energy)));
|
||||
RecipePulverizer recipe = ReflectionHelper.getInstance(ThermalHelper.pulverizerRecipe, toStack(input), toStack(output), toStack(secondary), secondaryChance, energy);
|
||||
|
||||
if(recipe != null) {
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error while creating instance for %s recipe.", name));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipePulverizer> {
|
||||
|
|
|
@ -46,7 +46,13 @@ public class Sawmill {
|
|||
return;
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(ReflectionHelper.getInstance(ThermalHelper.sawmillRecipe, toStack(input), toStack(output), toStack(secondary), secondaryChance, energy)));
|
||||
RecipeSawmill recipe = ReflectionHelper.getInstance(ThermalHelper.sawmillRecipe, toStack(input), toStack(output), toStack(secondary), secondaryChance, energy);
|
||||
|
||||
if(recipe != null) {
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error while creating instance for %s recipe.", name));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipeSawmill> {
|
||||
|
|
|
@ -46,7 +46,13 @@ public class Smelter {
|
|||
return;
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(ReflectionHelper.getInstance(ThermalHelper.smelterRecipe, toStack(input), toStack(input2), toStack(output), toStack(output2), chance, energy)));
|
||||
RecipeSmelter recipe = ReflectionHelper.getInstance(ThermalHelper.smelterRecipe, toStack(input), toStack(input2), toStack(output), toStack(output2), chance, energy);
|
||||
|
||||
if(recipe != null) {
|
||||
MineTweakerAPI.apply(new Add(recipe));
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error while creating instance for %s recipe.", name));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipeSmelter> {
|
||||
|
|
|
@ -46,7 +46,13 @@ public class Transposer {
|
|||
return;
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(ReflectionHelper.getInstance(ThermalHelper.transposerRecipe, toStack(input), toStack(output), toFluid(liquid), energy, 100), RecipeType.Fill));
|
||||
RecipeTransposer recipe = ReflectionHelper.getInstance(ThermalHelper.transposerRecipe, toStack(input), toStack(output), toFluid(liquid), energy, 100);
|
||||
|
||||
if(recipe != null) {
|
||||
MineTweakerAPI.apply(new Add(recipe, RecipeType.Fill));
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error while creating instance for %s recipe.", nameFill));
|
||||
}
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
|
@ -60,8 +66,14 @@ public class Transposer {
|
|||
LogHelper.logWarning(String.format("Duplicate %s Recipe found for %s and %s. Command ignored!", Transposer.nameExtract, InputHelper.getStackDescription(toStack(input)), InputHelper.getStackDescription(toFluid(liquid))));
|
||||
return;
|
||||
}
|
||||
|
||||
MineTweakerAPI.apply(new Add(ReflectionHelper.getInstance(ThermalHelper.transposerRecipe, toStack(input), toStack(output), toFluid(liquid), energy, 100), RecipeType.Extract));
|
||||
|
||||
RecipeTransposer recipe = ReflectionHelper.getInstance(ThermalHelper.transposerRecipe, toStack(input), toStack(output), toFluid(liquid), energy, 100);
|
||||
|
||||
if(recipe != null) {
|
||||
MineTweakerAPI.apply(new Add(recipe, RecipeType.Extract));
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error while creating instance for %s recipe.", nameExtract));
|
||||
}
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition<RecipeTransposer> {
|
||||
|
|
Loading…
Reference in a new issue