Clean up some logging + protect against negative values in Altar Recipes
This commit is contained in:
parent
43f2bdd28a
commit
61b2b293ba
|
@ -20,7 +20,7 @@ public class AltarRecipeRegistry {
|
|||
if (!recipes.containsValue(recipe))
|
||||
recipes.put(recipe.input, recipe);
|
||||
else
|
||||
BloodMagicAPI.getLogger().error("Error adding altar recipe for " + recipe.input.getDisplayName() + (recipe.output == null ? "" : " -> " + recipe.output.getDisplayName()) + ". Recipe already exists.");
|
||||
BloodMagicAPI.getLogger().error("Error adding altar recipe for %s. Recipe already exists.", recipe.input.getDisplayName(), recipe.output == null ? "" : " -> " );
|
||||
}
|
||||
|
||||
public static AltarRecipe getRecipeForInput(ItemStack input) {
|
||||
|
@ -49,30 +49,13 @@ public class AltarRecipeRegistry {
|
|||
* @param drainRate - The rate at which LP is drained during crafting
|
||||
* @param useTag -
|
||||
*/
|
||||
// public AltarRecipe(ItemStackWrapper input, @Nullable ItemStackWrapper output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate, boolean useTag) {
|
||||
// this.input = input;
|
||||
// this.output = output;
|
||||
// this.minTier = minTier;
|
||||
// this.syphon = syphon;
|
||||
// this.consumeRate = consumeRate;
|
||||
// this.drainRate = drainRate;
|
||||
// this.useTag = useTag;
|
||||
// }
|
||||
//
|
||||
// public AltarRecipe(ItemStackWrapper input, ItemStackWrapper output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate) {
|
||||
// this(input, output, minTier, syphon, consumeRate, drainRate, false);
|
||||
// }
|
||||
//
|
||||
// public AltarRecipe(ItemStackWrapper input, EnumAltarTier minTier, int consumeRate, int drainRate) {
|
||||
// this(input, null, minTier, 0, consumeRate, drainRate);
|
||||
// }
|
||||
public AltarRecipe(ItemStack input, @Nullable ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate, boolean useTag) {
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.minTier = minTier;
|
||||
this.syphon = syphon;
|
||||
this.consumeRate = consumeRate;
|
||||
this.drainRate = drainRate;
|
||||
this.syphon = syphon < 0 ? -syphon : syphon;
|
||||
this.consumeRate = consumeRate < 0 ? -consumeRate : consumeRate;
|
||||
this.drainRate = drainRate < 0 ? -drainRate : drainRate;
|
||||
this.useTag = useTag;
|
||||
}
|
||||
|
||||
|
@ -85,9 +68,8 @@ public class AltarRecipeRegistry {
|
|||
}
|
||||
|
||||
public boolean doesRequiredItemMatch(ItemStack comparedStack, EnumAltarTier tierCheck) {
|
||||
if (comparedStack == null || this.input == null) {
|
||||
if (comparedStack == null || this.input == null)
|
||||
return false;
|
||||
}
|
||||
|
||||
return tierCheck.ordinal() >= minTier.ordinal() && this.input.isItemEqual(comparedStack);// && (this.useTag ? this.areRequiredTagsEqual(comparedStack) : true);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class BindingRecipeRegistry {
|
|||
if (!recipes.containsValue(recipe))
|
||||
recipes.put(recipe.getInput(), recipe);
|
||||
else
|
||||
BloodMagicAPI.getLogger().error("Error adding binding recipe for " + recipe.input.getDisplayName() + (recipe.output == null ? "" : " -> " + recipe.output.getDisplayName()) + ". Recipe already exists.");
|
||||
BloodMagicAPI.getLogger().error("Error adding binding recipe for %s %s. Recipe already exists.", recipe.input.getDisplayName(), recipe.output == null ? "" : " -> " + recipe.output.getDisplayName());
|
||||
}
|
||||
|
||||
public static BindingRecipe getRecipeForInput(ItemStack input) {
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ImperfectRitualRegistry {
|
|||
public static void registerRitual(ImperfectRitual imperfectRitual, String id) {
|
||||
if (imperfectRitual != null) {
|
||||
if (registry.containsKey(id))
|
||||
BloodMagicAPI.getLogger().error("Duplicate imperfect ritual id: " + id);
|
||||
BloodMagicAPI.getLogger().error("Duplicate imperfect ritual id: %s", id);
|
||||
else
|
||||
registry.put(id, imperfectRitual);
|
||||
}
|
||||
|
|
|
@ -26,15 +26,15 @@ public class OrbRegistry {
|
|||
if (!orbs.contains(orb))
|
||||
orbs.add(orb);
|
||||
else
|
||||
BloodMagicAPI.getLogger().error("Error adding orb: " + orb.toString() + ". Orb already exists!");
|
||||
BloodMagicAPI.getLogger().error("Error adding orb %s. Orb already exists!", orb.toString());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerOrbTexture(BloodOrb orb, String resourceLocation) {
|
||||
int meta = getIndexOf(orb);
|
||||
|
||||
ModelBakery.addVariantName(BloodMagicAPI.getOrbItem(), resourceLocation);
|
||||
ModelLoader.setCustomModelResourceLocation(BloodMagicAPI.getOrbItem(), meta, new ModelResourceLocation(resourceLocation, "inventory"));
|
||||
ModelBakery.addVariantName(BloodMagicAPI.getItem(BloodMagicAPI.ORB), resourceLocation);
|
||||
ModelLoader.setCustomModelResourceLocation(BloodMagicAPI.getItem(BloodMagicAPI.ORB), meta, new ModelResourceLocation(resourceLocation, "inventory"));
|
||||
}
|
||||
|
||||
public static BloodOrb getOrb(int index) {
|
||||
|
@ -54,6 +54,6 @@ public class OrbRegistry {
|
|||
}
|
||||
|
||||
public static ItemStack getOrbStack(BloodOrb orb) {
|
||||
return new ItemStack(BloodMagicAPI.getOrbItem(), 1, getIndexOf(orb));
|
||||
return new ItemStack(BloodMagicAPI.getItem(BloodMagicAPI.ORB), 1, getIndexOf(orb));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class RitualRegistry {
|
|||
public static void registerRitual(Ritual ritual, String id) {
|
||||
if (ritual != null) {
|
||||
if (registry.containsKey(id))
|
||||
BloodMagicAPI.getLogger().error("Duplicate ritual id: " + id);
|
||||
BloodMagicAPI.getLogger().error("Duplicate ritual id: %s", id);
|
||||
else
|
||||
registry.put(id, ritual);
|
||||
}
|
||||
|
|
|
@ -12,23 +12,23 @@ public class LogHelper {
|
|||
this.logger = LogManager.getLogger(logger);
|
||||
}
|
||||
|
||||
public void info(Object info) {
|
||||
public void info(String info, Object ... format) {
|
||||
if (BloodMagicAPI.isLoggingEnabled())
|
||||
logger.info(info);
|
||||
logger.info(info, format);
|
||||
}
|
||||
|
||||
public void error(Object error) {
|
||||
public void error(String error, Object ... format) {
|
||||
if (BloodMagicAPI.isLoggingEnabled())
|
||||
logger.info(error);
|
||||
logger.info(error, format);
|
||||
}
|
||||
|
||||
public void debug(Object debug) {
|
||||
public void debug(String debug, Object ... format) {
|
||||
if (BloodMagicAPI.isLoggingEnabled())
|
||||
logger.info(debug);
|
||||
logger.info(debug, format);
|
||||
}
|
||||
|
||||
public void fatal(Object fatal) {
|
||||
logger.fatal(fatal);
|
||||
public void fatal(String fatal, Object ... format) {
|
||||
logger.fatal(fatal, format);
|
||||
}
|
||||
|
||||
public Logger getLogger() {
|
||||
|
|
Loading…
Reference in a new issue