package openperipheral.core.integration;

import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem;

import java.util.HashMap;
import java.util.Map;

import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import openperipheral.core.AdapterManager;
import openperipheral.core.adapter.ic2.AdapterEnergyConductor;
import openperipheral.core.adapter.ic2.AdapterEnergySink;
import openperipheral.core.adapter.ic2.AdapterEnergySource;
import openperipheral.core.adapter.ic2.AdapterEnergyStorage;
import openperipheral.core.adapter.ic2.AdapterMassFab;
import openperipheral.core.adapter.ic2.AdapterReactor;
import openperipheral.core.adapter.ic2.AdapterReactorChamber;

public class ModuleIC2 {

	public static void init() {
		AdapterManager.addPeripheralAdapter(new AdapterReactor());
		AdapterManager.addPeripheralAdapter(new AdapterReactorChamber());
		AdapterManager.addPeripheralAdapter(new AdapterMassFab());
		AdapterManager.addPeripheralAdapter(new AdapterEnergyConductor());
		AdapterManager.addPeripheralAdapter(new AdapterEnergySink());
		AdapterManager.addPeripheralAdapter(new AdapterEnergySource());
		AdapterManager.addPeripheralAdapter(new AdapterEnergyStorage());
	}

	
	@SuppressWarnings({ "unchecked", "rawtypes" })
  public static void appendIC2Info(Map map, ItemStack stack) {
    if (stack != null) {
      Item item = stack.getItem();
      if (item != null) {
        if (item instanceof IElectricItem) {
          IElectricItem electricItem = (IElectricItem)item;
          HashMap<String,Object> electricInfo = new HashMap<String,Object>();
          
          electricInfo.put("tier", electricItem.getTier(stack));
          electricInfo.put("maxCharge", electricItem.getMaxCharge(stack));
          electricInfo.put("transferLimit", electricItem.getTransferLimit(stack));
          electricInfo.put("canProvideEnergy", electricItem.canProvideEnergy(stack));
          electricInfo.put("charge", ElectricItem.manager.getCharge(stack));
          
          map.put("electric", electricInfo);
        }
      }
    }
  }
}

@@ -1373,42 +1373,11 @@
 ();%0A
-      if (item != null) %7B%0A        
+%09%09%09
 if (
@@ -1409,26 +1409,20 @@
 Item) %7B%0A
-          
+%09%09%09%09
 IElectri
@@ -1463,26 +1463,20 @@
 m)item;%0A
-          
+%09%09%09%09
 HashMap%3C
@@ -1535,37 +1535,25 @@
 ect%3E();%0A
-          %0A          
+%09%09%09%09%0A%09%09%09%09
 electric
@@ -1595,34 +1595,28 @@
 er(stack));%0A
-          
+%09%09%09%09
 electricInfo
@@ -1664,34 +1664,28 @@
 ge(stack));%0A
-          
+%09%09%09%09
 electricInfo
@@ -1741,34 +1741,28 @@
 it(stack));%0A
-          
+%09%09%09%09
 electricInfo
@@ -1825,26 +1825,20 @@
 tack));%0A
-          
+%09%09%09%09
 electric
@@ -1900,29 +1900,17 @@
 ));%0A
-          %0A          
+%09%09%09%09%0A%09%09%09%09
 map.
@@ -1944,18 +1944,8 @@
 o);%0A
-        %7D%0A
     

Remove redundant null check