Added charging items via IC2 API.
This commit is contained in:
parent
41a029ffb4
commit
2e23b92763
|
@ -19,126 +19,107 @@
|
||||||
package appeng.items.tools.powered.powersink;
|
package appeng.items.tools.powered.powersink;
|
||||||
|
|
||||||
|
|
||||||
//import java.util.Optional;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
//
|
import net.minecraft.item.ItemStack;
|
||||||
//import net.minecraft.entity.EntityLivingBase;
|
|
||||||
//import net.minecraft.item.Item;
|
import ic2.api.item.IElectricItemManager;
|
||||||
//import net.minecraft.item.ItemStack;
|
import ic2.api.item.ISpecialElectricItem;
|
||||||
//
|
|
||||||
//import ic2.api.item.IElectricItemManager;
|
import appeng.api.config.PowerUnits;
|
||||||
//import ic2.api.item.ISpecialElectricItem;
|
import appeng.integration.IntegrationType;
|
||||||
//
|
import appeng.transformer.annotations.Integration.Interface;
|
||||||
//import appeng.api.config.PowerUnits;
|
import appeng.transformer.annotations.Integration.InterfaceList;
|
||||||
//import appeng.integration.IntegrationType;
|
import appeng.transformer.annotations.Integration.Method;
|
||||||
//import appeng.transformer.annotations.Integration.Interface;
|
|
||||||
//import appeng.transformer.annotations.Integration.InterfaceList;
|
|
||||||
//import appeng.transformer.annotations.Integration.Method;
|
@InterfaceList( value = {
|
||||||
//
|
@Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = IntegrationType.IC2 ),
|
||||||
//
|
@Interface( iface = "ic2.api.item.IElectricItemManager", iname = IntegrationType.IC2 )
|
||||||
//@InterfaceList( value = { @Interface( iface = "ic2.api.item.ISpecialElectricItem", iname = IntegrationType.IC2 ), @Interface( iface = "ic2.api.item.IElectricItemManager", iname = IntegrationType.IC2 ) } )
|
} )
|
||||||
//public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem
|
public abstract class IC2 extends AERootPoweredItem implements IElectricItemManager, ISpecialElectricItem
|
||||||
//{
|
{
|
||||||
// public IC2( double powerCapacity, Optional<String> subName )
|
public IC2( double powerCapacity )
|
||||||
// {
|
{
|
||||||
// super( powerCapacity, subName );
|
super( powerCapacity );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public double charge( ItemStack is, double amount, int tier, boolean ignoreTransferLimit, boolean simulate )
|
public double charge( ItemStack is, double amount, int tier, boolean ignoreTransferLimit, boolean simulate )
|
||||||
// {
|
{
|
||||||
// double addedAmt = amount;
|
double addedAmt = amount;
|
||||||
// double limit = this.getTransferLimit( is );
|
double limit = this.getTransferLimit( is );
|
||||||
//
|
|
||||||
// if( !ignoreTransferLimit && amount > limit )
|
if( !ignoreTransferLimit && amount > limit )
|
||||||
// {
|
{
|
||||||
// addedAmt = limit;
|
addedAmt = limit;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
|
return addedAmt - ( (int) this.injectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public double discharge( ItemStack itemStack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate )
|
public double discharge( ItemStack itemStack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate )
|
||||||
// {
|
{
|
||||||
// return 0;
|
return 0;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public double getCharge( ItemStack is )
|
public double getCharge( ItemStack is )
|
||||||
// {
|
{
|
||||||
// return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
|
return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public boolean canUse( ItemStack is, double amount )
|
public boolean canUse( ItemStack is, double amount )
|
||||||
// {
|
{
|
||||||
// return this.getCharge( is ) > amount;
|
return this.getCharge( is ) > amount;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public boolean use( ItemStack is, double amount, EntityLivingBase entity )
|
public boolean use( ItemStack is, double amount, EntityLivingBase entity )
|
||||||
// {
|
{
|
||||||
// if( this.canUse( is, amount ) )
|
if( this.canUse( is, amount ) )
|
||||||
// {
|
{
|
||||||
// // use the power..
|
// use the power..
|
||||||
// this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
|
this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
|
||||||
// return true;
|
return true;
|
||||||
// }
|
}
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void chargeFromArmor( ItemStack itemStack, EntityLivingBase entity )
|
public void chargeFromArmor( ItemStack itemStack, EntityLivingBase entity )
|
||||||
// {
|
{
|
||||||
// // wtf?
|
// wtf?
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public String getToolTip( ItemStack itemStack )
|
public String getToolTip( ItemStack itemStack )
|
||||||
// {
|
{
|
||||||
// return null;
|
return null;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public boolean canProvideEnergy( ItemStack itemStack )
|
public double getMaxCharge( ItemStack itemStack )
|
||||||
// {
|
{
|
||||||
// return false;
|
return PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( itemStack ) );
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public Item getChargedItem( ItemStack itemStack )
|
public int getTier( ItemStack itemStack )
|
||||||
// {
|
{
|
||||||
// return itemStack.getItem();
|
return 1;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Override
|
private double getTransferLimit( ItemStack itemStack )
|
||||||
// public Item getEmptyItem( ItemStack itemStack )
|
{
|
||||||
// {
|
return Math.max( 32, this.getMaxCharge( itemStack ) / 200 );
|
||||||
// return itemStack.getItem();
|
}
|
||||||
// }
|
|
||||||
//
|
@Override
|
||||||
// @Override
|
@Method( iname = IntegrationType.IC2 )
|
||||||
// public double getMaxCharge( ItemStack itemStack )
|
public IElectricItemManager getManager( ItemStack itemStack )
|
||||||
// {
|
{
|
||||||
// return PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( itemStack ) );
|
return this;
|
||||||
// }
|
}
|
||||||
//
|
}
|
||||||
// @Override
|
|
||||||
// public int getTier( ItemStack itemStack )
|
|
||||||
// {
|
|
||||||
// return 1;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public double getTransferLimit( ItemStack itemStack )
|
|
||||||
// {
|
|
||||||
// return Math.max( 32, this.getMaxCharge( itemStack ) / 200 );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// @Method( iname = IntegrationType.IC2 )
|
|
||||||
// public IElectricItemManager getManager( ItemStack itemStack )
|
|
||||||
// {
|
|
||||||
// return this;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ import appeng.transformer.annotations.Integration.Interface;
|
||||||
|
|
||||||
|
|
||||||
@Interface( iface = "cofh.api.energy.IEnergyContainerItem", iname = IntegrationType.RFItem )
|
@Interface( iface = "cofh.api.energy.IEnergyContainerItem", iname = IntegrationType.RFItem )
|
||||||
public abstract class RedstoneFlux extends AERootPoweredItem implements IEnergyContainerItem
|
public abstract class RedstoneFlux extends IC2 implements IEnergyContainerItem
|
||||||
{
|
{
|
||||||
public RedstoneFlux( final double powerCapacity )
|
public RedstoneFlux( final double powerCapacity )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue