Fully remove old LogHelper usage

This commit is contained in:
Nicholas Ignoffo 2018-03-17 17:18:20 -07:00
parent 924dc7b38d
commit 77e5beb9e1
11 changed files with 14 additions and 64 deletions

View file

@ -4,7 +4,6 @@ import WayofTime.bloodmagic.api.BloodMagicPlugin;
import WayofTime.bloodmagic.api.IBloodMagicPlugin; import WayofTime.bloodmagic.api.IBloodMagicPlugin;
import WayofTime.bloodmagic.core.registry.OrbRegistry; import WayofTime.bloodmagic.core.registry.OrbRegistry;
import WayofTime.bloodmagic.ritual.RitualRegistry; import WayofTime.bloodmagic.ritual.RitualRegistry;
import WayofTime.bloodmagic.util.helper.LogHelper;
import WayofTime.bloodmagic.client.gui.GuiHandler; import WayofTime.bloodmagic.client.gui.GuiHandler;
import WayofTime.bloodmagic.command.CommandBloodMagic; import WayofTime.bloodmagic.command.CommandBloodMagic;
import WayofTime.bloodmagic.core.RegistrarBloodMagic; import WayofTime.bloodmagic.core.RegistrarBloodMagic;
@ -65,7 +64,6 @@ public class BloodMagic {
FluidRegistry.enableUniversalBucket(); FluidRegistry.enableUniversalBucket();
} }
public LogHelper logger = new LogHelper(MODID);
private File configDir; private File configDir;
@Mod.EventHandler @Mod.EventHandler

View file

@ -2,11 +2,8 @@ package WayofTime.bloodmagic.alchemyArray;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;

View file

@ -1,19 +1,14 @@
package WayofTime.bloodmagic.client.render.alchemyArray; package WayofTime.bloodmagic.client.render.alchemyArray;
import java.util.List;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec2f;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffect; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffect;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectArrowTurret; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectArrowTurret;

View file

@ -1,6 +1,6 @@
package WayofTime.bloodmagic.compress; package WayofTime.bloodmagic.compress;
import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.util.BMLog;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.InventoryCrafting;
@ -19,7 +19,7 @@ public class StorageBlockCraftingManager {
public void addStorageBlockRecipes() { public void addStorageBlockRecipes() {
// this.recipes = new StorageBlockCraftingRecipeAssimilator().getPackingRecipes(); // 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) { public ItemStack findMatchingRecipe(InventoryCrafting craftingInventory, World world) {

View file

@ -1,8 +1,8 @@
package WayofTime.bloodmagic.meteor; package WayofTime.bloodmagic.meteor;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.ConfigHandler; import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.gson.Serializers; import WayofTime.bloodmagic.gson.Serializers;
import WayofTime.bloodmagic.util.BMLog;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -29,7 +29,7 @@ public class MeteorConfigHandler {
public static void handleMeteors(boolean checkNewVersion) { public static void handleMeteors(boolean checkNewVersion) {
if (meteorDir == null) { 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; return;
} }

View file

@ -16,6 +16,7 @@ import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare;
import WayofTime.bloodmagic.soul.DemonWillHolder; import WayofTime.bloodmagic.soul.DemonWillHolder;
import WayofTime.bloodmagic.tile.*; import WayofTime.bloodmagic.tile.*;
import WayofTime.bloodmagic.tile.routing.TileRoutingNode; import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
import WayofTime.bloodmagic.util.BMLog;
import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.util.Constants;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -117,10 +118,9 @@ public class ClientProxy extends CommonProxy {
Map<String, RenderPlayer> skinMap = ObfuscationReflectionHelper.getPrivateValue(RenderManager.class, renderManager, "skinMap", "field_178636_l"); Map<String, RenderPlayer> skinMap = ObfuscationReflectionHelper.getPrivateValue(RenderManager.class, renderManager, "skinMap", "field_178636_l");
skinMap.get("default").addLayer(new LayerBloodElytra(skinMap.get("default"))); skinMap.get("default").addLayer(new LayerBloodElytra(skinMap.get("default")));
skinMap.get("slim").addLayer(new LayerBloodElytra(skinMap.get("slim"))); 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) { } catch (Exception e) {
BloodMagic.instance.logger.error("Failed to set custom Elytra Layer for Elytra Living Armour Upgrade."); BMLog.DEBUG.error("Failed to set custom Elytra Layer for Elytra Living Armour Upgrade: {}", e.getMessage());
BloodMagic.instance.logger.error(e.getLocalizedMessage());
} }
} }

View file

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import WayofTime.bloodmagic.util.BMLog;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.init.MobEffects; import net.minecraft.init.MobEffects;
@ -19,7 +20,6 @@ import net.minecraftforge.oredict.OreDictionary;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectArrowTurret; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectArrowTurret;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectAttractor; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectAttractor;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectBinding; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectBinding;
@ -140,7 +140,7 @@ public class ModRecipes
CompressionRegistry.registerItemThreshold(new ItemStack(Blocks.COBBLESTONE), 64); CompressionRegistry.registerItemThreshold(new ItemStack(Blocks.COBBLESTONE), 64);
stopwatch.stop(); stopwatch.stop();
BloodMagic.instance.logger.info("Added compression recipes in {}", stopwatch); BMLog.DEBUG.info("Added compression recipes in {}", stopwatch);
} }
public static void addAlchemyTableRecipes() public static void addAlchemyTableRecipes()

View file

@ -4,11 +4,9 @@ import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable; import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffect; import WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffect;

View file

@ -1,6 +1,5 @@
package WayofTime.bloodmagic.util; package WayofTime.bloodmagic.util;
import WayofTime.bloodmagic.util.helper.LogHelper;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
/** /**
@ -13,7 +12,5 @@ import net.minecraft.util.DamageSource;
public class PleaseStopUsingMe { public class PleaseStopUsingMe {
public static boolean loggingEnabled; public static boolean loggingEnabled;
public static LogHelper logger = new LogHelper("BloodMagic|API");
public static DamageSource damageSource = new DamageSourceBloodMagic(); public static DamageSource damageSource = new DamageSourceBloodMagic();
} }

View file

@ -2,6 +2,7 @@ package WayofTime.bloodmagic.util.handler.event;
import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.ConfigHandler; import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.util.BMLog;
import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.util.Constants;
import WayofTime.bloodmagic.ritual.RitualRegistry; import WayofTime.bloodmagic.ritual.RitualRegistry;
import WayofTime.bloodmagic.ritual.Ritual; import WayofTime.bloodmagic.ritual.Ritual;
@ -211,10 +212,10 @@ public class ClientHandler {
missingVariants.removeAll(missing); missingVariants.removeAll(missing);
if (errored.size() > 0) 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) if (missing.size() > 0)
BloodMagic.instance.logger.info("Suppressed {} variant errors from Blood Magic.", missing.size()); BMLog.DEBUG.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 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. // 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); missingTextures.keySet().remove(mc);
badTextureDomains.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) { private static void renderRitualStones(EntityPlayerSP player, float partialTicks) {

View file

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