aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/slots/SlotDataStick.java
blob: ce97a2fdbf61a1f591c8993efb328b79f8fa3da7 (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
package gtPlusPlus.core.slots;

import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;

import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.recipe.common.CI;

public class SlotDataStick extends Slot {

	public SlotDataStick(final IInventory inventory, final int slot, final int x, final int y) {
		super(inventory, slot, x, y);

	}

	public static ItemStack[] mDataItems = new ItemStack[2];
	
	@Override
	public synchronized boolean isItemValid(final ItemStack itemstack) {
		boolean isValid = false;
		if (itemstack != null) {			
			if (mDataItems[0] == null) {
				mDataItems[0] = CI.getDataStick();
			}
			if (mDataItems[1] == null) {
				mDataItems[1] = CI.getDataOrb();
			}
			if (mDataItems[0] != null && mDataItems[1] != null) {
				if (GT_Utility.areStacksEqual(itemstack, mDataItems[0], true) || GT_Utility.areStacksEqual(itemstack, mDataItems[1], true) ) {
					isValid = true;
				}
			}						
		}
		return isValid;
	}

	@Override
	public int getSlotStackLimit() {
		return 1;
	}
}