Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package net.minecraft.server;
2
3public class InventoryCrafting implements IInventory {
4
5 private ItemStack[] items;
6 private int b;
7 private Container c;
8
9 // CraftBukkit start
10 public ItemStack[] getContents() {
11 return this.items;
12 }
13 // CraftBukkit end
14
15 public InventoryCrafting(Container container, int i, int j) {
16 int k = i * j;
17
18 this.items = new ItemStack[k];
19 this.c = container;
20 this.b = i;
21 }
22
23 public int getSize() {
24 return this.items.length;
25 }
26
27 public ItemStack getItem(int i) {
28 return i >= this.getSize() ? null : this.items[i];
29 }
30
31 public ItemStack b(int i, int j) {
32 if (i >= 0 && i < this.b) {
33 int k = i + j * this.b;
34
35 return this.getItem(k);
36 } else {
37 return null;
38 }
39 }
40
41 public String getName() {
42 return "Crafting";
43 }
44
45 public ItemStack splitStack(int i, int j) {
46 if (this.items[i] != null) {
47 ItemStack itemstack;
48
49 if (this.items[i].count <= j) {
50 itemstack = this.items[i];
51 this.items[i] = null;
52 this.c.a((IInventory) this);
53 return itemstack;
54 } else {
55 itemstack = this.items[i].a(j);
56 if (this.items[i].count == 0) {
57 this.items[i] = null;
58 }
59
60 this.c.a((IInventory) this);
61 return itemstack;
62 }
63 } else {
64 return null;
65 }
66 }
67
68 public void setItem(int i, ItemStack itemstack) {
69 this.items[i] = itemstack;
70 this.c.a((IInventory) this);
71 }
72
73 public int getMaxStackSize() {
74 return 64;
75 }
76
77 public void update() {
78 }
79
80 public boolean a_(EntityHuman entityhuman) {
81 return true;
82 }
83}