aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/slots/SlotBuzzSaw.java
blob: 0d8ce34ab54f27efc8a0d0206cca895d7e871c6d (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
62
63
64
65
66
package gtPlusPlus.core.slots;

import gregtech.api.enums.OrePrefixes;
import gregtech.api.items.GT_MetaGenerated_Tool;
import gregtech.common.items.GT_MetaGenerated_Item_02;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;

public class SlotBuzzSaw extends Slot{

	public SAWTOOL currentTool = SAWTOOL.NONE;

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

	}

	@Override
	public boolean isItemValid(ItemStack itemstack) {
		boolean isValid = false;

		if (itemstack != null){
			if (itemstack.getItem() instanceof GT_MetaGenerated_Item_02 || itemstack.getItem() instanceof GT_MetaGenerated_Tool){
				//Buzzsaw Blade //TODO
				/*if (OrePrefixes.toolHeadBuzzSaw.contains(itemstack)){
					isValid = false;					
				}*/
				if (OrePrefixes.craftingTool.contains(itemstack)){
					if (itemstack.getDisplayName().toLowerCase().contains("saw")){					
						if (itemstack.getItemDamage() == 10){
							isValid = true;
							currentTool = SAWTOOL.SAW;
						}
						if (itemstack.getItemDamage() == 140){
							isValid = true;
							currentTool = SAWTOOL.BUZZSAW;
						}
					}
				}
				else {
					currentTool = SAWTOOL.NONE;
				}
			}
			else {
				currentTool = SAWTOOL.NONE;
			}
		}	
		else {
			currentTool = SAWTOOL.NONE;
		}
		return isValid;
	}

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

	public enum SAWTOOL {
		NONE,
		SAW,
		BUZZSAW
	}

}