package de.nedelosk.modularmachines.common.plugins.mekanism;

import de.nedelosk.modularmachines.api.material.EnumMetalMaterials;
import de.nedelosk.modularmachines.api.modules.containers.IModuleItemContainer;
import de.nedelosk.modularmachines.api.modules.containers.ModuleContainer;
import de.nedelosk.modularmachines.api.modules.json.EnumLoaderType;
import de.nedelosk.modularmachines.api.modules.json.ModuleLoaderRegistry;
import de.nedelosk.modularmachines.api.modules.storage.energy.IModuleBatteryProperties;
import de.nedelosk.modularmachines.common.config.Config;
import de.nedelosk.modularmachines.common.plugins.APlugin;
import de.nedelosk.modularmachines.common.plugins.cofh.ModuleRFBattery;
import de.nedelosk.modularmachines.common.plugins.cofh.ModuleRFBatteryProperties;
import de.nedelosk.modularmachines.common.plugins.cofh.ModuleRFBatteryPropertiesLoader;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class PluginMekanism extends APlugin {

	public static Item energyCube;
	public static ModuleRFBattery moduleEnergyCube;
	public static IModuleBatteryProperties[] moduleEnergyCubeProperties = new IModuleBatteryProperties[4];
	public static IModuleItemContainer[] moduleEnergyCubeContainers = new IModuleItemContainer[4];

	@Override
	public void preInit() {
		if(ModuleRFBatteryPropertiesLoader.loader == null){
			ModuleLoaderRegistry.registerLoader(EnumLoaderType.PROPERTY, ModuleRFBatteryPropertiesLoader.loader = new ModuleRFBatteryPropertiesLoader());
		}
		moduleEnergyCube = new ModuleRFBattery("energy_cube");
		moduleEnergyCube.setRegistryName(new ResourceLocation("modularmachines:battery.energycube"));
		GameRegistry.register(moduleEnergyCube);
	}

	@Override
	public void init() {
		energyCube = ForgeRegistries.ITEMS.getValue(new ResourceLocation("mekanism", "EnergyCube"));

		moduleEnergyCubeProperties[0] = new ModuleRFBatteryProperties(2, (int) (2000000 * 0.4), 800, 1);
		moduleEnergyCubeProperties[1] = new ModuleRFBatteryProperties(4, (int) (8000000 * 0.4), 3200, 2);
		moduleEnergyCubeProperties[2] = new ModuleRFBatteryProperties(6, (int) (32000000 * 0.4), 12800, 3);
		moduleEnergyCubeProperties[3] = new ModuleRFBatteryProperties(8, (int) (128000000 * 0.4), 51200, 4);

		moduleEnergyCubeContainers[0] = GameRegistry.register(new ModuleItemContainerEnergyCube(EnumMetalMaterials.IRON, 0, new ModuleContainer(moduleEnergyCube, moduleEnergyCubeProperties[0])));
		moduleEnergyCubeContainers[1] = GameRegistry.register(new ModuleItemContainerEnergyCube(EnumMetalMaterials.OSMIUM, 1, new ModuleContainer(moduleEnergyCube, moduleEnergyCubeProperties[1])));
		moduleEnergyCubeContainers[2] = GameRegistry.register(new ModuleItemContainerEnergyCube(EnumMetalMaterials.GOLD, 2, new ModuleContainer(moduleEnergyCube, moduleEnergyCubeProperties[2])));
		moduleEnergyCubeContainers[3] = GameRegistry.register(new ModuleItemContainerEnergyCube(EnumMetalMaterials.STEEL, 3, new ModuleContainer(moduleEnergyCube, moduleEnergyCubeProperties[3])));
	}

	@Override
	public String getRequiredMod() {
		return "Mekanism";
	}

	@Override
	public boolean isActive() {
		return Config.pluginMekanism;
	}
}

@@ -55,16 +55,95 @@
 anism;%0A%0A
+%0Aimport static de.nedelosk.modularmachines.api.modules.ModuleManager.register;%0A
 import d
@@ -2477,37 +2477,24 @@
 ainers%5B0%5D = 
-GameRegistry.
 register(new
@@ -2621,16 +2621,49 @@
 ies%5B0%5D))
+, %22battery.mekanism.energycube.0%22
 );%0A%09%09mod
@@ -2687,37 +2687,24 @@
 ainers%5B1%5D = 
-GameRegistry.
 register(new
@@ -2833,16 +2833,49 @@
 ies%5B1%5D))
+, %22battery.mekanism.energycube.1%22
 );%0A%09%09mod
@@ -2899,37 +2899,24 @@
 ainers%5B2%5D = 
-GameRegistry.
 register(new
@@ -3043,16 +3043,49 @@
 ies%5B2%5D))
+, %22battery.mekanism.energycube.2%22
 );%0A%09%09mod
@@ -3113,29 +3113,16 @@
 rs%5B3%5D = 
-GameRegistry.
 register
@@ -3254,16 +3254,49 @@
 ies%5B3%5D))
+, %22battery.mekanism.energycube.3%22
 );%0A%09%7D%0A%0A%09

Fix mekanism plugin