package net.machinemuse.powersuits.powermodule.tool;

import net.machinemuse.api.IModularItem;
import net.machinemuse.powersuits.common.ModCompatability;
import net.machinemuse.powersuits.item.ItemComponent;
import net.machinemuse.powersuits.powermodule.PowerModuleBase;
import net.machinemuse.utils.MuseCommonStrings;
import net.machinemuse.utils.MuseItemUtils;

import java.util.List;

/**
 * Created by User: Andrew2448
 * 7:21 PM 4/25/13
 */
public class MFFSFieldTeleporterModule extends PowerModuleBase {
    public static final String MODULE_FIELD_TELEPORTER = "MFFS Field Teleporter";
    public static final String FIELD_TELEPORTER_ENERGY_CONSUMPTION = "Field Teleporter Energy Consumption";

    public MFFSFieldTeleporterModule(List<IModularItem> validItems) throws IllegalAccessException, NoSuchFieldException, ClassNotFoundException {
        super(validItems);
        addBaseProperty(FIELD_TELEPORTER_ENERGY_CONSUMPTION, 20000, "J");
        addInstallCost(ModCompatability.getMFFSItem("MFFSitemForcePowerCrystal", 1));
        addInstallCost(MuseItemUtils.copyAndResize(ItemComponent.controlCircuit, 1));
    }

    @Override
    public String getCategory() {
        return MuseCommonStrings.CATEGORY_TOOL;
    }

    @Override
    public String getName() {
        return MODULE_FIELD_TELEPORTER;
    }

    @Override
    public String getDescription() {
        return "A tool which allows you to teleport through MFFS forcefields that you own if you have enough energy.";
    }

    @Override
    public String getTextureFile() {
        return "fieldteleporter";
    }
}

@@ -355,16 +355,53 @@
 emUtils;
+%0Aimport net.minecraft.item.ItemStack;
 %0A%0Aimport
@@ -987,31 +987,34 @@
         
-addInstallCost(
+ItemStack stack = 
 ModCompa
@@ -1061,24 +1061,183 @@
 Crystal%22, 1)
+;%0A        if (stack == null) %7B%0A            throw new IllegalAccessException(%22Failed to get MFFS forcefield teleporter%22);%0A        %7D%0A        addInstallCost(stack
 );%0A        a

fix for MFFS NPE