summaryrefslogtreecommitdiff
path: root/ihl/recipes/RecipeOutputItemStack.java
blob: 480d1f81997e2c19fc3694defb53c86854c42fc2 (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
package ihl.recipes;

import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;

public class RecipeOutputItemStack {
	public final ItemStack itemStack;
	public final float quantity;

	public RecipeOutputItemStack(ItemStack itemStack1, float quantity1) {
		itemStack = itemStack1;
		quantity = quantity1;
		itemStack.stackSize = 1;
	}

	public RecipeOutputItemStack(ItemStack itemStack1) {
		this(itemStack1, itemStack1.stackSize);
	}

	public boolean matches(RecipeOutputItemStack is1) {
		if (is1 == null || (itemStack.getItem() != is1.itemStack.getItem())) {
			return false;
		} else if (is1.itemStack.getItemDamage() != OreDictionary.WILDCARD_VALUE
				&& itemStack.getItemDamage() != is1.itemStack.getItemDamage()) {
			return false;
		}
		return true;
	}

	public RecipeOutputItemStack copy(int mulipier) {
		return new RecipeOutputItemStack(itemStack, quantity * mulipier);
	}

	public RecipeOutputItemStack copy() {
		return new RecipeOutputItemStack(itemStack, quantity);
	}

	@Override
	public String toString() {
		return this.itemStack.getUnlocalizedName() + ":" + this.quantity;
	}

	public boolean matches(ItemStack is1) {
		if (is1 == null || (itemStack.getItem() != is1.getItem())) {
			return false;
		} else if (is1.getItemDamage() != OreDictionary.WILDCARD_VALUE
				&& itemStack.getItemDamage() != is1.getItemDamage()) {
			return false;
		}
		return true;
	}
}