summaryrefslogtreecommitdiff
path: root/src/main/java/ihl/processing/invslots/InvSlotUpgradeIHL.java
blob: 5c1fff926ab45ffe5ba81119a09e826c2ba2c4ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package ihl.processing.invslots;

import ic2.core.Ic2Items;
import ic2.core.block.TileEntityInventory;
import ic2.core.block.invslot.InvSlot;
import ihl.utils.IHLUtils;
import net.minecraft.item.ItemStack;

public class InvSlotUpgradeIHL extends InvSlot {

	public InvSlotUpgradeIHL(int count) {
		super(count);
	}

	public InvSlotUpgradeIHL(TileEntityInventory base, int oldStartIndex, Access access, int count, InvSide side) {
		super(base, "invSlotUpgrade", oldStartIndex, access, count, side);
	}

	public double getPowerConsumtionMultiplier() {
		double base = 1d;
		for (int i = 0; i < this.size(); i++) {
			if (IHLUtils.isItemStacksIsEqual(this.get(i), Ic2Items.overclockerUpgrade, false)) {
				int i1 = this.get(i).stackSize;
				while (i1-- > 0 && base < 600) {
					base *= 1.6f;
				}
			}
		}
		return base;
	}

	public float getProgressMultiplier() {
		float base = 1f;
		for (int i = 0; i < this.size(); i++) {
			if (IHLUtils.isItemStacksIsEqual(this.get(i), Ic2Items.overclockerUpgrade, false)) {
				int i1 = this.get(i).stackSize;
				while (i1-- > 0 && base < 600) {
					base *= 1.428571429f;
				}
			}
		}
		return base;
	}

	public int getAdditionalEnergyStorage() {
		int base = 0;
		for (int i = 0; i < this.size(); i++) {
			if (IHLUtils.isItemStacksIsEqual(this.get(i), Ic2Items.energyStorageUpgrade, false)) {
				base += this.get(i).stackSize * 10000;
			}
		}
		return base;
	}

	@Override
	public boolean accepts(ItemStack stack) {
		return IHLUtils.isItemStacksIsEqual(stack, Ic2Items.overclockerUpgrade, false) || 
				IHLUtils.isItemStacksIsEqual(stack, Ic2Items.energyStorageUpgrade, false);
	}

}