Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 82 lines 2.4 kB view raw
1package net.minecraft.server; 2 3public class ShapedRecipes implements CraftingRecipe { 4 5 private int b; 6 private int c; 7 private ItemStack[] d; 8 private ItemStack e; 9 public final int a; 10 11 public ShapedRecipes(int i, int j, ItemStack[] aitemstack, ItemStack itemstack) { 12 this.a = itemstack.id; 13 this.b = i; 14 this.c = j; 15 this.d = aitemstack; 16 this.e = itemstack; 17 } 18 19 public ItemStack b() { 20 return this.e; 21 } 22 23 public boolean a(InventoryCrafting inventorycrafting) { 24 for (int i = 0; i <= 3 - this.b; ++i) { 25 for (int j = 0; j <= 3 - this.c; ++j) { 26 if (this.a(inventorycrafting, i, j, true)) { 27 return true; 28 } 29 30 if (this.a(inventorycrafting, i, j, false)) { 31 return true; 32 } 33 } 34 } 35 36 return false; 37 } 38 39 private boolean a(InventoryCrafting inventorycrafting, int i, int j, boolean flag) { 40 for (int k = 0; k < 3; ++k) { 41 for (int l = 0; l < 3; ++l) { 42 int i1 = k - i; 43 int j1 = l - j; 44 ItemStack itemstack = null; 45 46 if (i1 >= 0 && j1 >= 0 && i1 < this.b && j1 < this.c) { 47 if (flag) { 48 itemstack = this.d[this.b - i1 - 1 + j1 * this.b]; 49 } else { 50 itemstack = this.d[i1 + j1 * this.b]; 51 } 52 } 53 54 ItemStack itemstack1 = inventorycrafting.b(k, l); 55 56 if (itemstack1 != null || itemstack != null) { 57 if (itemstack1 == null && itemstack != null || itemstack1 != null && itemstack == null) { 58 return false; 59 } 60 61 if (itemstack.id != itemstack1.id) { 62 return false; 63 } 64 65 if (itemstack.getData() != -1 && itemstack.getData() != itemstack1.getData()) { 66 return false; 67 } 68 } 69 } 70 } 71 72 return true; 73 } 74 75 public ItemStack b(InventoryCrafting inventorycrafting) { 76 return new ItemStack(this.e.id, this.e.count, this.e.getData()); 77 } 78 79 public int a() { 80 return this.b * this.c; 81 } 82}