mirror of
https://github.com/GTNewHorizons/WirelessCraftingTerminal.git
synced 2026-11-19 19:50:00 +00:00
Resolve #31
This commit is contained in:
1 parent
3317ecf868
commit
17fc100dae
7 files changed
+2
-351
No files matched your search
@@ -9,9 +9,7 @@ public enum IntegrationType
|
||||
|
||||
//InvTweaks( IntegrationSide.CLIENT, "Inventory Tweaks", "inventorytweaks" ),
|
||||
|
||||
NEI( IntegrationSide.CLIENT, "Not Enough Items", "NotEnoughItems" ),
|
||||
|
||||
IC2( IntegrationSide.BOTH, "Industrial Craft 2", "IC2" );
|
||||
NEI( IntegrationSide.CLIENT, "Not Enough Items", "NotEnoughItems" );
|
||||
|
||||
public final IntegrationSide side;
|
||||
public final String dspName;
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package net.p455w0rd.wirelesscraftingterminal.integration.modules;
|
||||
|
||||
import net.p455w0rd.wirelesscraftingterminal.helpers.Reflected;
|
||||
import net.p455w0rd.wirelesscraftingterminal.integration.IIntegrationModule;
|
||||
import net.p455w0rd.wirelesscraftingterminal.integration.IntegrationHelper;
|
||||
|
||||
public class IC2 implements IIntegrationModule
|
||||
{
|
||||
@Reflected
|
||||
public static IC2 instance;
|
||||
|
||||
@Reflected
|
||||
public IC2()
|
||||
{
|
||||
IntegrationHelper.testClassExistence( this, ic2.api.item.IElectricItem.class );
|
||||
IntegrationHelper.testClassExistence( this, ic2.api.item.ISpecialElectricItem.class );
|
||||
IntegrationHelper.testClassExistence( this, ic2.api.item.IElectricItemManager.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
}
|
||||
}
|
||||
+1
-132
@@ -16,7 +16,6 @@ import appeng.api.config.ViewItems;
|
||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
import appeng.items.tools.powered.powersink.AERootPoweredItem;
|
||||
import appeng.util.ConfigManager;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
@@ -25,11 +24,8 @@ import cofh.api.energy.IEnergyContainerItem;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import ic2.api.item.IElectricItemManager;
|
||||
import ic2.api.item.ISpecialElectricItem;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -44,7 +40,7 @@ import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
|
||||
|
||||
public class ItemWirelessCraftingTerminal extends AERootPoweredItem implements IWirelessCraftingTermHandler, IAEItemPowerStorage, IAEFeature, IEnergyContainerItem, IElectricItemManager, ISpecialElectricItem
|
||||
public class ItemWirelessCraftingTerminal extends AERootPoweredItem implements IWirelessCraftingTermHandler, IAEItemPowerStorage, IAEFeature, IEnergyContainerItem
|
||||
{
|
||||
|
||||
private static final String LINK_KEY_STRING = "key";
|
||||
@@ -423,132 +419,5 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem implements
|
||||
public int getMaxEnergyStored(ItemStack container) {
|
||||
return (int) PowerUnits.AE.convertTo(PowerUnits.RF, getAEMaxPower(container));
|
||||
}
|
||||
|
||||
//IC2 integration
|
||||
private double wctInjectExternalPower( final PowerUnits input, final ItemStack is, final double amount, final boolean simulate )
|
||||
{
|
||||
if( simulate )
|
||||
{
|
||||
final int requiredEU = (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( is ) - this.getAECurrentPower( is ) );
|
||||
if( amount < requiredEU )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return amount - requiredEU;
|
||||
}
|
||||
else
|
||||
{
|
||||
final double powerRemainder = this.injectAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
|
||||
return PowerUnits.AE.convertTo( PowerUnits.EU, powerRemainder );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double charge( final ItemStack is, final double amount, final int tier, final boolean ignoreTransferLimit, final boolean simulate )
|
||||
{
|
||||
double addedAmt = amount;
|
||||
final double limit = this.getTransferLimit( is );
|
||||
|
||||
if( !ignoreTransferLimit && amount > limit )
|
||||
{
|
||||
addedAmt = limit;
|
||||
}
|
||||
|
||||
return addedAmt - ( (int) this.wctInjectExternalPower( PowerUnits.EU, is, addedAmt, simulate ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public double discharge( final ItemStack itemStack, final double amount, final int tier, final boolean ignoreTransferLimit, final boolean externally, final boolean simulate )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCharge( final ItemStack is )
|
||||
{
|
||||
return (int) PowerUnits.AE.convertTo( PowerUnits.EU, this.getAECurrentPower( is ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUse( final ItemStack is, final double amount )
|
||||
{
|
||||
return this.getCharge( is ) > amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean use( final ItemStack is, final double amount, final EntityLivingBase entity )
|
||||
{
|
||||
if( this.canUse( is, amount ) )
|
||||
{
|
||||
// use the power..
|
||||
this.extractAEPower( is, PowerUnits.EU.convertTo( PowerUnits.AE, amount ) );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chargeFromArmor( final ItemStack itemStack, final EntityLivingBase entity )
|
||||
{
|
||||
// wtf?
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToolTip( final ItemStack itemStack )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvideEnergy( final ItemStack itemStack )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getChargedItem( final ItemStack itemStack )
|
||||
{
|
||||
return itemStack.getItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getEmptyItem( final ItemStack itemStack )
|
||||
{
|
||||
return itemStack.getItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMaxCharge( final ItemStack itemStack )
|
||||
{
|
||||
return PowerUnits.AE.convertTo( PowerUnits.EU, this.getAEMaxPower( itemStack ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTier( final ItemStack itemStack )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTransferLimit( final ItemStack itemStack )
|
||||
{
|
||||
return Math.max( 32, this.getMaxCharge( itemStack ) / 200 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IElectricItemManager getManager( final ItemStack itemStack )
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFeatureHandler handler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
// X)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user