/**
 * Copyright 2017 3TUSK, et al.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package info.tritusk.robustimc;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.JsonToNBT;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.Logger;

import java.io.File;
import java.io.FileInputStream;
import java.util.Locale;

@Mod(modid = "robustimc", name = "RobustIMC", version = "@VERSION", useMetadata = true)
public class RobustIMC {

    private static File jsonFile = null;
    private static Logger log;

    @Mod.EventHandler
    public void preInit(FMLPreInitializationEvent event) {
        log = event.getModLog();
        jsonFile = new File(event.getModConfigurationDirectory(), "robustimc.json");
    }
    @Mod.EventHandler
    public void init(FMLInitializationEvent event) {
        if (jsonFile == null || !jsonFile.exists() || !jsonFile.isFile()) {
            return;
        }

        try {
            NBTBase base = JsonToNBT.func_150315_a(IOUtils.toString(new FileInputStream(jsonFile), "UTF-8"));
            if (base instanceof NBTTagList) {
                NBTTagList theTag = (NBTTagList) base;
                for (int index = 0; index < theTag.tagCount(); index++) {
                    NBTTagCompound tag = theTag.getCompoundTagAt(index);
                    final String receiverMod = tag.getString("modid");
                    final String messageKey = tag.getString("key");
                    switch (tag.getString("type").toLowerCase(Locale.ENGLISH)) {
                        case("string"): {
                            FMLInterModComms.sendMessage(receiverMod, messageKey, tag.getString("message"));
                            break;
                        }
                        case("nbt"): {
                            FMLInterModComms.sendMessage(receiverMod, messageKey, tag.getCompoundTag("message"));
                            break;
                        }
                        case("stack"):
                        case("itemstack"): {
                            FMLInterModComms.sendMessage(receiverMod, messageKey, ItemStack.loadItemStackFromNBT(tag.getCompoundTag("message")));
                            break;
                        }
                        default: {
                            log.error("Yes, you have unsupported message type! Double check your json first!");
                            break;
                        }
                    }
                }
            } else {
                log.error("Well, you should know that you need an array of messages...");
            }
        } catch (Exception e) {
            log.warn("RobustIMC encountered with error while resolving IMC message. It will stop being functional.");
            log.catching(e);
        }
        jsonFile = null;
        log = null;
    }
}

@@ -659,19 +659,22 @@
 .common.
-Mod
+FMLLog
 ;%0Aimport
@@ -698,36 +698,11 @@
 mon.
-event.FMLInitializationEvent
+Mod
 ;%0Aim
@@ -1024,22 +1024,23 @@
 mons.io.
-IOUtil
+Charset
 s;%0Aimpor
@@ -1056,28 +1056,26 @@
 che.
-logging.log4j.Logger
+commons.io.IOUtils
 ;%0A%0Ai
@@ -1251,13 +1251,12 @@
 lic 
-class
+enum
  Rob
@@ -1273,75 +1273,118 @@
     
-private static File jsonFile = null;%0A    private static Logger log;
+INSTANCE;%0A%0A    @Mod.InstanceFactory%0A    public static RobustIMC getInstance() %7B%0A        return INSTANCE;%0A    %7D
 %0A%0A  
@@ -1474,40 +1474,12 @@
     
-log = event.getModLog();%0A       
+File
  jso
@@ -1560,117 +1560,16 @@
     
-%7D%0A    @Mod.EventHandler%0A    public void init(FMLInitializationEvent event) %7B%0A        if (jsonFile == null %7C%7C 
+    if (
 !jso
@@ -1650,16 +1650,71 @@
      try
+ (FileInputStream json = new FileInputStream(jsonFile))
  %7B%0A     
@@ -1780,46 +1780,28 @@
 ing(
-new FileInputStream(jsonFile), %22UTF-8%22
+json, Charsets.UTF_8
 ));%0A
@@ -3052,44 +3052,58 @@
     
-log.error(%22Yes, you have unsupported
+FMLLog.warning(%22%5BRobustIMC%5D Yes, one of your input
  mes
@@ -3111,16 +3111,27 @@
 age type
+ is invalid
 ! Double
@@ -3299,19 +3299,35 @@
     
-log.error(%22
+FMLLog.severe(%22%5BRobustIMC%5D 
 Well
@@ -3420,19 +3420,19 @@
 ch (
-Exception e
+Throwable t
 ) %7B%0A
@@ -3447,18 +3447,46 @@
     
-log.warn(%22
+FMLLog.getLogger().error(%22%5BRobustIMC%5D 
 Robu
@@ -3578,94 +3578,23 @@
 al.%22
-);%0A            log.catching(e);%0A        %7D%0A        jsonFile = null;%0A        log = null;
+, t);%0A        %7D
 %0A   

Stop statically refer to objects - this mod should be as trivial as possible