diff --git a/src/java/ic2/api/item/IElectricItem.java b/src/java/ic2/api/item/IElectricItem.java deleted file mode 100644 index 4f546d5..0000000 --- a/src/java/ic2/api/item/IElectricItem.java +++ /dev/null @@ -1,57 +0,0 @@ -package ic2.api.item; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -/** - * Provides the ability to store energy on the implementing item. - * - * The item should have a maximum damage of 13. - */ -public interface IElectricItem { - /** - * Determine if the item can be used in a machine or as an armor part to supply energy. - * - * @return Whether the item can supply energy - */ - boolean canProvideEnergy(ItemStack itemStack); - - /** - * Get the item ID to use for a charge energy greater than 0. - * - * @return Item ID to use - */ - Item getChargedItem(ItemStack itemStack); - - /** - * Get the item ID to use for a charge energy of 0. - * - * @return Item ID to use - */ - Item getEmptyItem(ItemStack itemStack); - - /** - * Get the item's maximum charge energy in EU. - * - * @return Maximum charge energy - */ - double getMaxCharge(ItemStack itemStack); - - /** - * Get the item's tier, lower tiers can't send energy to higher ones. - * - * Batteries are Tier 1, Advanced Batteries are Tier 2, Energy Crystals are Tier 3, Lapotron - * Crystals are Tier 4. - * - * @return Item's tier - */ - int getTier(ItemStack itemStack); - - /** - * Get the item's transfer limit in EU per transfer operation. - * - * @return Transfer limit - */ - double getTransferLimit(ItemStack itemStack); -} - diff --git a/src/java/ic2/api/item/IElectricItemManager.java b/src/java/ic2/api/item/IElectricItemManager.java deleted file mode 100644 index 5de43d7..0000000 --- a/src/java/ic2/api/item/IElectricItemManager.java +++ /dev/null @@ -1,95 +0,0 @@ -package ic2.api.item; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; - -/** - * This interface specifies a manager to handle the various tasks for electric items. - * - * The default implementation does the following: - * - store and retrieve the charge - * - handle charging, taking amount, tier, transfer limit, canProvideEnergy and simulate into account - * - replace item IDs if appropriate (getChargedItemId() and getEmptyItemId()) - * - update and manage the damage value for the visual charge indicator - * - * @note If you're implementing your own variant (ISpecialElectricItem), you can delegate to the - * default implementations through ElectricItem.rawManager. The default implementation is designed - * to minimize its dependency on its own constraints/structure and delegates most work back to the - * more atomic features in the gateway manager. - */ -public interface IElectricItemManager { - /** - * Charge an item with a specified amount of energy. - * - * @param itemStack electric item's stack - * @param amount amount of energy to charge in EU - * @param tier tier of the charging device, has to be at least as high as the item to charge - * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() - * @param simulate don't actually change the item, just determine the return value - * @return Energy transferred into the electric item - */ - double charge(ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean simulate); - - /** - * Discharge an item by a specified amount of energy - * - * @param itemStack electric item's stack - * @param amount amount of energy to discharge in EU - * @param tier tier of the discharging device, has to be at least as high as the item to discharge - * @param ignoreTransferLimit ignore the transfer limit specified by getTransferLimit() - * @param externally use the supplied item externally, i.e. to power something else as if it was a battery - * @param simulate don't actually discharge the item, just determine the return value - * @return Energy retrieved from the electric item - */ - double discharge(ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate); - - /** - * Determine the charge level for the specified item. - * - * @param itemStack ItemStack containing the electric item - * @return charge level in EU - */ - double getCharge(ItemStack stack); - - /** - * Determine if the specified electric item has at least a specific amount of EU. - * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. - * BatPacks are not taken into account. - * - * @param itemStack electric item's stack - * @param amount minimum amount of energy required - * @return true if there's enough energy - */ - boolean canUse(ItemStack stack, double amount); - - /** - * Try to retrieve a specific amount of energy from an Item, and if applicable, a BatPack. - * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. - * - * @param itemStack electric item's stack - * @param amount amount of energy to discharge in EU - * @param entity entity holding the item - * @return true if the operation succeeded - */ - boolean use(ItemStack stack, double amount, EntityLivingBase entity); - - /** - * Charge an item from the BatPack a player is wearing. - * This is supposed to be used in the item code during operation, for example if you want to implement your own electric item. - * use() already contains this functionality. - * - * @param itemStack electric item's stack - * @param entity entity holding the item - */ - void chargeFromArmor(ItemStack stack, EntityLivingBase entity); - - /** - * Get the tool tip to display for electric items. - * - * @param itemStack ItemStack to determine the tooltip for - * @return tool tip string or null for none - */ - String getToolTip(ItemStack stack); - - // TODO: add tier getter -} diff --git a/src/java/ic2/api/item/ISpecialElectricItem.java b/src/java/ic2/api/item/ISpecialElectricItem.java deleted file mode 100644 index a7302f5..0000000 --- a/src/java/ic2/api/item/ISpecialElectricItem.java +++ /dev/null @@ -1,13 +0,0 @@ -package ic2.api.item; - -import net.minecraft.item.ItemStack; - -public interface ISpecialElectricItem extends IElectricItem { - /** - * Supply a custom IElectricItemManager. - * - * @param itemStack ItemStack to get the manager for - * @return IElectricItemManager instance - */ - IElectricItemManager getManager(ItemStack itemStack); -} diff --git a/src/java/ic2/api/item/package-info.java b/src/java/ic2/api/item/package-info.java deleted file mode 100644 index 44ecdce..0000000 --- a/src/java/ic2/api/item/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion="1.0", owner="IC2", provides="IC2API") -package ic2.api.item; -import cpw.mods.fml.common.API; - diff --git a/src/java/net/p455w0rd/wirelesscraftingterminal/integration/IntegrationType.java b/src/java/net/p455w0rd/wirelesscraftingterminal/integration/IntegrationType.java index 873ede4..c184d93 100644 --- a/src/java/net/p455w0rd/wirelesscraftingterminal/integration/IntegrationType.java +++ b/src/java/net/p455w0rd/wirelesscraftingterminal/integration/IntegrationType.java @@ -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; diff --git a/src/java/net/p455w0rd/wirelesscraftingterminal/integration/modules/IC2.java b/src/java/net/p455w0rd/wirelesscraftingterminal/integration/modules/IC2.java deleted file mode 100644 index 45d8f3b..0000000 --- a/src/java/net/p455w0rd/wirelesscraftingterminal/integration/modules/IC2.java +++ /dev/null @@ -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 . - */ - -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() - { - } -} diff --git a/src/java/net/p455w0rd/wirelesscraftingterminal/items/ItemWirelessCraftingTerminal.java b/src/java/net/p455w0rd/wirelesscraftingterminal/items/ItemWirelessCraftingTerminal.java index f4e55e0..ff12403 100644 --- a/src/java/net/p455w0rd/wirelesscraftingterminal/items/ItemWirelessCraftingTerminal.java +++ b/src/java/net/p455w0rd/wirelesscraftingterminal/items/ItemWirelessCraftingTerminal.java @@ -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) - } }