From 77e5beb9e185f45f79b6e6655a39cd1f90e3b9f6 Mon Sep 17 00:00:00 2001 From: Nicholas Ignoffo Date: Sat, 17 Mar 2018 17:18:20 -0700 Subject: [PATCH] Fully remove old LogHelper usage --- .../java/WayofTime/bloodmagic/BloodMagic.java | 2 -- .../AlchemyArrayEffectLaputa.java | 3 -- .../TurretAlchemyCircleRenderer.java | 5 --- .../compress/StorageBlockCraftingManager.java | 4 +-- .../meteor/MeteorConfigHandler.java | 4 +-- .../bloodmagic/proxy/ClientProxy.java | 6 ++-- .../bloodmagic/registry/ModRecipes.java | 4 +-- .../bloodmagic/tile/TileAlchemyArray.java | 2 -- .../bloodmagic/util/PleaseStopUsingMe.java | 3 -- .../util/handler/event/ClientHandler.java | 9 ++--- .../bloodmagic/util/helper/LogHelper.java | 36 ------------------- 11 files changed, 14 insertions(+), 64 deletions(-) delete mode 100644 src/main/java/WayofTime/bloodmagic/util/helper/LogHelper.java diff --git a/src/main/java/WayofTime/bloodmagic/BloodMagic.java b/src/main/java/WayofTime/bloodmagic/BloodMagic.java index 4581753c..630607c9 100644 --- a/src/main/java/WayofTime/bloodmagic/BloodMagic.java +++ b/src/main/java/WayofTime/bloodmagic/BloodMagic.java @@ -4,7 +4,6 @@ import WayofTime.bloodmagic.api.BloodMagicPlugin; import WayofTime.bloodmagic.api.IBloodMagicPlugin; import WayofTime.bloodmagic.core.registry.OrbRegistry; import WayofTime.bloodmagic.ritual.RitualRegistry; -import WayofTime.bloodmagic.util.helper.LogHelper; import WayofTime.bloodmagic.client.gui.GuiHandler; import WayofTime.bloodmagic.command.CommandBloodMagic; import WayofTime.bloodmagic.core.RegistrarBloodMagic; @@ -65,7 +64,6 @@ public class BloodMagic { FluidRegistry.enableUniversalBucket(); } - public LogHelper logger = new LogHelper(MODID); private File configDir; @Mod.EventHandler diff --git a/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectLaputa.java b/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectLaputa.java index cdb1e14e..d3701692 100644 --- a/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectLaputa.java +++ b/src/main/java/WayofTime/bloodmagic/alchemyArray/AlchemyArrayEffectLaputa.java @@ -2,11 +2,8 @@ package WayofTime.bloodmagic.alchemyArray; import java.util.Random; -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; diff --git a/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/TurretAlchemyCircleRenderer.java b/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/TurretAlchemyCircleRenderer.java index 66039503..967b4638 100644 --- a/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/TurretAlchemyCircleRenderer.java +++ b/src/main/java/WayofTime/bloodmagic/client/render/alchemyArray/TurretAlchemyCircleRenderer.java @@ -1,19 +1,14 @@ package WayofTime.bloodmagic.client.render.alchemyArray; -import java.util.List; - import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec2f; import net.minecraft.world.World; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffect; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectArrowTurret; diff --git a/src/main/java/WayofTime/bloodmagic/compress/StorageBlockCraftingManager.java b/src/main/java/WayofTime/bloodmagic/compress/StorageBlockCraftingManager.java index 4dd1822c..19e06bb4 100644 --- a/src/main/java/WayofTime/bloodmagic/compress/StorageBlockCraftingManager.java +++ b/src/main/java/WayofTime/bloodmagic/compress/StorageBlockCraftingManager.java @@ -1,6 +1,6 @@ package WayofTime.bloodmagic.compress; -import WayofTime.bloodmagic.BloodMagic; +import WayofTime.bloodmagic.util.BMLog; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.InventoryCrafting; @@ -19,7 +19,7 @@ public class StorageBlockCraftingManager { public void addStorageBlockRecipes() { // this.recipes = new StorageBlockCraftingRecipeAssimilator().getPackingRecipes(); - BloodMagic.instance.logger.info("Total number of compression recipes: " + this.recipes.size()); + BMLog.DEBUG.info("Total number of compression recipes: " + this.recipes.size()); } public ItemStack findMatchingRecipe(InventoryCrafting craftingInventory, World world) { diff --git a/src/main/java/WayofTime/bloodmagic/meteor/MeteorConfigHandler.java b/src/main/java/WayofTime/bloodmagic/meteor/MeteorConfigHandler.java index c608e061..c6e1b65c 100644 --- a/src/main/java/WayofTime/bloodmagic/meteor/MeteorConfigHandler.java +++ b/src/main/java/WayofTime/bloodmagic/meteor/MeteorConfigHandler.java @@ -1,8 +1,8 @@ package WayofTime.bloodmagic.meteor; -import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.ConfigHandler; import WayofTime.bloodmagic.gson.Serializers; +import WayofTime.bloodmagic.util.BMLog; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; @@ -29,7 +29,7 @@ public class MeteorConfigHandler { public static void handleMeteors(boolean checkNewVersion) { if (meteorDir == null) { - BloodMagic.instance.logger.error("Attempted to handle meteor config but the folder has not been initialized. Was this run too early?"); + BMLog.DEFAULT.error("Attempted to handle meteor config but the folder has not been initialized. Was this run too early?"); return; } diff --git a/src/main/java/WayofTime/bloodmagic/proxy/ClientProxy.java b/src/main/java/WayofTime/bloodmagic/proxy/ClientProxy.java index d24ce3b8..1f8ff251 100644 --- a/src/main/java/WayofTime/bloodmagic/proxy/ClientProxy.java +++ b/src/main/java/WayofTime/bloodmagic/proxy/ClientProxy.java @@ -16,6 +16,7 @@ import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare; import WayofTime.bloodmagic.soul.DemonWillHolder; import WayofTime.bloodmagic.tile.*; import WayofTime.bloodmagic.tile.routing.TileRoutingNode; +import WayofTime.bloodmagic.util.BMLog; import WayofTime.bloodmagic.util.Constants; import com.google.common.collect.ImmutableMap; import net.minecraft.client.Minecraft; @@ -117,10 +118,9 @@ public class ClientProxy extends CommonProxy { Map skinMap = ObfuscationReflectionHelper.getPrivateValue(RenderManager.class, renderManager, "skinMap", "field_178636_l"); skinMap.get("default").addLayer(new LayerBloodElytra(skinMap.get("default"))); skinMap.get("slim").addLayer(new LayerBloodElytra(skinMap.get("slim"))); - BloodMagic.instance.logger.info("Elytra layer added"); + BMLog.DEBUG.info("Elytra layer added"); } catch (Exception e) { - BloodMagic.instance.logger.error("Failed to set custom Elytra Layer for Elytra Living Armour Upgrade."); - BloodMagic.instance.logger.error(e.getLocalizedMessage()); + BMLog.DEBUG.error("Failed to set custom Elytra Layer for Elytra Living Armour Upgrade: {}", e.getMessage()); } } diff --git a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java index 14386ee5..f8375a0e 100644 --- a/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java +++ b/src/main/java/WayofTime/bloodmagic/registry/ModRecipes.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import WayofTime.bloodmagic.util.BMLog; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.init.MobEffects; @@ -19,7 +20,6 @@ import net.minecraftforge.oredict.OreDictionary; import org.apache.commons.lang3.tuple.Pair; -import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectArrowTurret; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectAttractor; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectBinding; @@ -140,7 +140,7 @@ public class ModRecipes CompressionRegistry.registerItemThreshold(new ItemStack(Blocks.COBBLESTONE), 64); stopwatch.stop(); - BloodMagic.instance.logger.info("Added compression recipes in {}", stopwatch); + BMLog.DEBUG.info("Added compression recipes in {}", stopwatch); } public static void addAlchemyTableRecipes() diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyArray.java b/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyArray.java index 1a02cbd2..a8f0ff7c 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyArray.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileAlchemyArray.java @@ -4,11 +4,9 @@ import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.ITickable; import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffect; diff --git a/src/main/java/WayofTime/bloodmagic/util/PleaseStopUsingMe.java b/src/main/java/WayofTime/bloodmagic/util/PleaseStopUsingMe.java index 072d7986..368bd44e 100644 --- a/src/main/java/WayofTime/bloodmagic/util/PleaseStopUsingMe.java +++ b/src/main/java/WayofTime/bloodmagic/util/PleaseStopUsingMe.java @@ -1,6 +1,5 @@ package WayofTime.bloodmagic.util; -import WayofTime.bloodmagic.util.helper.LogHelper; import net.minecraft.util.DamageSource; /** @@ -13,7 +12,5 @@ import net.minecraft.util.DamageSource; public class PleaseStopUsingMe { public static boolean loggingEnabled; - public static LogHelper logger = new LogHelper("BloodMagic|API"); - public static DamageSource damageSource = new DamageSourceBloodMagic(); } diff --git a/src/main/java/WayofTime/bloodmagic/util/handler/event/ClientHandler.java b/src/main/java/WayofTime/bloodmagic/util/handler/event/ClientHandler.java index 472ed94f..ebc027cd 100644 --- a/src/main/java/WayofTime/bloodmagic/util/handler/event/ClientHandler.java +++ b/src/main/java/WayofTime/bloodmagic/util/handler/event/ClientHandler.java @@ -2,6 +2,7 @@ package WayofTime.bloodmagic.util.handler.event; import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.ConfigHandler; +import WayofTime.bloodmagic.util.BMLog; import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.ritual.RitualRegistry; import WayofTime.bloodmagic.ritual.Ritual; @@ -211,10 +212,10 @@ public class ClientHandler { missingVariants.removeAll(missing); if (errored.size() > 0) - BloodMagic.instance.logger.info("Suppressed {} model errors from Blood Magic.", errored.size()); + BMLog.DEBUG.info("Suppressed {} model errors from Blood Magic.", errored.size()); if (missing.size() > 0) - BloodMagic.instance.logger.info("Suppressed {} variant errors from Blood Magic.", missing.size()); - BloodMagic.instance.logger.debug("Suppressed discovered model/variant errors in {}", stopwatch.stop()); + BMLog.DEBUG.info("Suppressed {} variant errors from Blood Magic.", missing.size()); + BMLog.DEBUG.info("Suppressed discovered model/variant errors in {}", stopwatch.stop()); } // For some reason, we need some bad textures to be listed in the Crystal and Node models. This will hide that from the end user. @@ -247,7 +248,7 @@ public class ClientHandler { missingTextures.keySet().remove(mc); badTextureDomains.remove(mc); } - BloodMagic.instance.logger.debug("Suppressed required texture errors in {}", stopwatch.stop()); + BMLog.DEBUG.info("Suppressed required texture errors in {}", stopwatch.stop()); } private static void renderRitualStones(EntityPlayerSP player, float partialTicks) { diff --git a/src/main/java/WayofTime/bloodmagic/util/helper/LogHelper.java b/src/main/java/WayofTime/bloodmagic/util/helper/LogHelper.java deleted file mode 100644 index 3876068e..00000000 --- a/src/main/java/WayofTime/bloodmagic/util/helper/LogHelper.java +++ /dev/null @@ -1,36 +0,0 @@ -package WayofTime.bloodmagic.util.helper; - -import WayofTime.bloodmagic.util.PleaseStopUsingMe; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class LogHelper { - private Logger logger; - - public LogHelper(String logger) { - this.logger = LogManager.getLogger(logger); - } - - public void info(String info, Object... format) { - if (PleaseStopUsingMe.loggingEnabled) - logger.info(info, format); - } - - public void error(String error, Object... format) { - if (PleaseStopUsingMe.loggingEnabled) - logger.error(error, format); - } - - public void debug(String debug, Object... format) { - if (PleaseStopUsingMe.loggingEnabled) - logger.debug(debug, format); - } - - public void fatal(String fatal, Object... format) { - logger.error(fatal, format); - } - - public Logger getLogger() { - return logger; - } -}