Applied-Energistics-2-tiler.../items/tools/powered/powersink/IC2.java
AlgorithmX2 9a64980443 Build Script Update.
FMP Fixes
Optional Interfaces for BC
Optional Interfaces for IC2
Removed UE Api on Items
Proxied Effect for C-CQuartz
2014-01-28 11:29:17 -06:00

65 lines
1.5 KiB
Java

package appeng.items.tools.powered.powersink;
import ic2.api.item.IElectricItemManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import appeng.api.config.PowerUnits;
import cpw.mods.fml.common.Optional.Interface;
@Interface(iface = "ic2.api.item.IElectricItemManager", modid = "IC2")
public class IC2 extends AERootPoweredItem implements IElectricItemManager
{
public IC2(Class c, String subname) {
super( c, subname );
}
@Override
public int charge(ItemStack is, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
{
return amount - ((int) injectExternalPower( PowerUnits.EU, is, amount, simulate ));
}
@Override
public int discharge(ItemStack itemStack, int amount, int tier, boolean ignoreTransferLimit, boolean simulate)
{
return 0;
}
@Override
public int getCharge(ItemStack is)
{
return (int) PowerUnits.AE.convertTo( PowerUnits.EU, getAECurrentPower( is ) );
}
@Override
public boolean canUse(ItemStack is, int amount)
{
return getCharge( is ) > amount;
}
@Override
public boolean use(ItemStack is, int amount, EntityLivingBase entity)
{
if ( canUse( is, amount ) )
{
// use the power..
extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
return true;
}
return false;
}
@Override
public void chargeFromArmor(ItemStack itemStack, EntityLivingBase entity)
{
// wtf?
}
@Override
public String getToolTip(ItemStack itemStack)
{
return null;
}
}