diff options
| author | Foghrye4 <foghrye4@gmail.com> | 2017-06-17 08:12:18 +0300 |
|---|---|---|
| committer | Foghrye4 <foghrye4@gmail.com> | 2017-06-17 08:12:18 +0300 |
| commit | dc3df3edd5843bde0c1335d6a8e460b2c832aa48 (patch) | |
| tree | af13bfeee567f2351e35e1ef176d168fe37c8aac /ihl/utils/IHLInvSlotDischarge.java | |
| parent | 1da8dcd58647e34c9af94ceeecaeaf3b0d08c48c (diff) | |
full project files
Diffstat (limited to 'ihl/utils/IHLInvSlotDischarge.java')
| -rw-r--r-- | ihl/utils/IHLInvSlotDischarge.java | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/ihl/utils/IHLInvSlotDischarge.java b/ihl/utils/IHLInvSlotDischarge.java deleted file mode 100644 index ffa4216..0000000 --- a/ihl/utils/IHLInvSlotDischarge.java +++ /dev/null @@ -1,83 +0,0 @@ -package ihl.utils;
-
-import ic2.api.info.Info;
-import ic2.api.item.ElectricItem;
-import ic2.core.block.TileEntityInventory;
-import ic2.core.block.invslot.InvSlot;
-import net.minecraft.init.Items;
-import net.minecraft.item.ItemStack;
-
-public class IHLInvSlotDischarge extends InvSlot
-{
- public int tier;
- public boolean allowRedstoneDust;
-
- public IHLInvSlotDischarge(TileEntityInventory base, int oldStartIndex, InvSlot.Access access, int tier)
- {
- this(base, oldStartIndex, access, tier, InvSlot.InvSide.ANY);
- }
-
- public IHLInvSlotDischarge(TileEntityInventory base, int oldStartIndex, InvSlot.Access access, int tier, InvSlot.InvSide preferredSide)
- {
- this(base, oldStartIndex, access, tier, true, preferredSide);
- }
-
- public IHLInvSlotDischarge(TileEntityInventory base, int oldStartIndex, InvSlot.Access access, int tier, boolean allowRedstoneDust, InvSlot.InvSide preferredSide)
- {
- super(base, "discharge", oldStartIndex, access, 1, preferredSide);
- this.allowRedstoneDust = true;
- this.tier = tier;
- this.allowRedstoneDust = allowRedstoneDust;
- }
-
- @Override
- public boolean accepts(ItemStack stack)
- {
- return stack == null ? false : (stack.getItem() == Items.redstone && !this.allowRedstoneDust ? false : Info.itemEnergy.getEnergyValue(stack) > 0.0D || ElectricItem.manager.discharge(stack, Double.POSITIVE_INFINITY, this.tier, true, true, true) > 0.0D);
- }
-
- public double discharge(double amount, boolean ignoreLimit)
- {
- if (amount <= 0.0D)
- {
- throw new IllegalArgumentException("Amount must be > 0.");
- }
- else
- {
- ItemStack stack = this.get(0);
-
- if (stack == null)
- {
- return 0.0D;
- }
- else
- {
- double realAmount = ElectricItem.manager.discharge(stack, amount, this.tier, ignoreLimit, true, false);
-
- if (realAmount <= 0.0D)
- {
- realAmount = Info.itemEnergy.getEnergyValue(stack);
-
- if (realAmount <= 0.0D)
- {
- return 0.0D;
- }
-
- --stack.stackSize;
-
- if (stack.stackSize <= 0)
- {
- this.put(0, (ItemStack)null);
- }
- }
-
- return realAmount;
- }
- }
- }
-
- public void setTier(int tier1)
- {
- this.tier = tier1;
- }
-}
\ No newline at end of file |
