Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package net.minecraft.server;
2
3import java.util.ArrayList;
4import java.util.Iterator;
5import java.util.List;
6
7public class ShapelessRecipes implements CraftingRecipe {
8
9 private final ItemStack a;
10 private final List b;
11
12 public ShapelessRecipes(ItemStack itemstack, List list) {
13 this.a = itemstack;
14 this.b = list;
15 }
16
17 public ItemStack b() {
18 return this.a;
19 }
20
21 public boolean a(InventoryCrafting inventorycrafting) {
22 ArrayList arraylist = new ArrayList(this.b);
23
24 for (int i = 0; i < 3; ++i) {
25 for (int j = 0; j < 3; ++j) {
26 ItemStack itemstack = inventorycrafting.b(j, i);
27
28 if (itemstack != null) {
29 boolean flag = false;
30 Iterator iterator = arraylist.iterator();
31
32 while (iterator.hasNext()) {
33 ItemStack itemstack1 = (ItemStack) iterator.next();
34
35 if (itemstack.id == itemstack1.id && (itemstack1.getData() == -1 || itemstack.getData() == itemstack1.getData())) {
36 flag = true;
37 arraylist.remove(itemstack1);
38 break;
39 }
40 }
41
42 if (!flag) {
43 return false;
44 }
45 }
46 }
47 }
48
49 return arraylist.isEmpty();
50 }
51
52 public ItemStack b(InventoryCrafting inventorycrafting) {
53 return this.a.cloneItemStack();
54 }
55
56 public int a() {
57 return this.b.size();
58 }
59}