blob: 8182a5fd8f3c5a62a69cb6c9a099845121a8867b (
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
67
68
|
package net.minecraft.server;
public class RecipeBookClone extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends
// CraftBukkit start - Delegate to new parent class
public RecipeBookClone() {
super(new ItemStack(Items.WRITTEN_BOOK, 0, -1), java.util.Arrays.asList(new ItemStack(Items.BOOK_AND_QUILL, 0, 0)));
}
// CraftBukkit end
public boolean a(InventoryCrafting inventoryCrafting, World paramWorld) {
int i = 0;
ItemStack itemStack = null;
for (int j = 0; j < inventoryCrafting.getSize(); j++) {
ItemStack itemStack1 = inventoryCrafting.getItem(j);
if (itemStack1 != null) {
if (itemStack1.getItem() == Items.WRITTEN_BOOK) {
if (itemStack != null) {
return false;
}
itemStack = itemStack1;
} else if (itemStack1.getItem() == Items.BOOK_AND_QUILL) {
i++;
} else {
return false;
}
}
}
return (itemStack != null) && (i > 0);
}
public ItemStack a(InventoryCrafting inventoryCrafting) {
int i = 0;
ItemStack itemStack = null;
for (int j = 0; j < inventoryCrafting.getSize(); j++) {
ItemStack itemStack2 = inventoryCrafting.getItem(j);
if (itemStack2 != null) {
if (itemStack2.getItem() == Items.WRITTEN_BOOK) {
if (itemStack != null) {
return null;
}
itemStack = itemStack2;
} else if (itemStack2.getItem() == Items.BOOK_AND_QUILL) {
i++;
} else {
return null;
}
}
}
if ((itemStack == null) || (i < 1)) {
return null;
}
ItemStack itemStack1 = new ItemStack(Items.WRITTEN_BOOK, i + 1);
itemStack1.setTag((NBTTagCompound) itemStack.getTag().clone());
if (itemStack.hasName()) {
itemStack1.c(itemStack.getName());
}
return itemStack1;
}
public int a() {
return 9;
}
public ItemStack b() {
return null;
}
}
|