Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package net.minecraft.server;
2
3public class ContainerFurnace extends Container {
4
5 private TileEntityFurnace a;
6 private int b = 0;
7 private int c = 0;
8 private int h = 0;
9
10 public ContainerFurnace(InventoryPlayer inventoryplayer, TileEntityFurnace tileentityfurnace) {
11 this.a = tileentityfurnace;
12 this.a(new Slot(tileentityfurnace, 0, 56, 17));
13 this.a(new Slot(tileentityfurnace, 1, 56, 53));
14 this.a(new SlotResult2(inventoryplayer.d, tileentityfurnace, 2, 116, 35));
15
16 int i;
17
18 for (i = 0; i < 3; ++i) {
19 for (int j = 0; j < 9; ++j) {
20 this.a(new Slot(inventoryplayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
21 }
22 }
23
24 for (i = 0; i < 9; ++i) {
25 this.a(new Slot(inventoryplayer, i, 8 + i * 18, 142));
26 }
27 }
28
29 public void a(ICrafting icrafting) {
30 super.a(icrafting);
31 icrafting.a(this, 0, this.a.cookTime);
32 icrafting.a(this, 1, this.a.burnTime);
33 icrafting.a(this, 2, this.a.ticksForCurrentFuel);
34 }
35
36 public void a() {
37 super.a();
38
39 for (int i = 0; i < this.listeners.size(); ++i) {
40 ICrafting icrafting = (ICrafting) this.listeners.get(i);
41
42 if (this.b != this.a.cookTime) {
43 icrafting.a(this, 0, this.a.cookTime);
44 }
45
46 if (this.c != this.a.burnTime) {
47 icrafting.a(this, 1, this.a.burnTime);
48 }
49
50 if (this.h != this.a.ticksForCurrentFuel) {
51 icrafting.a(this, 2, this.a.ticksForCurrentFuel);
52 }
53 }
54
55 this.b = this.a.cookTime;
56 this.c = this.a.burnTime;
57 this.h = this.a.ticksForCurrentFuel;
58 }
59
60 public boolean b(EntityHuman entityhuman) {
61 return this.a.a_(entityhuman);
62 }
63
64 public ItemStack a(int i) {
65 ItemStack itemstack = null;
66 Slot slot = (Slot) this.e.get(i);
67
68 if (slot != null && slot.b()) {
69 ItemStack itemstack1 = slot.getItem();
70
71 itemstack = itemstack1.cloneItemStack();
72 if (i == 2) {
73 this.a(itemstack1, 3, 39, true);
74 } else if (i >= 3 && i < 30) {
75 this.a(itemstack1, 30, 39, false);
76 } else if (i >= 30 && i < 39) {
77 this.a(itemstack1, 3, 30, false);
78 } else {
79 this.a(itemstack1, 3, 39, false);
80 }
81
82 if (itemstack1.count == 0) {
83 slot.c((ItemStack) null);
84 } else {
85 slot.c();
86 }
87
88 if (itemstack1.count == itemstack.count) {
89 return null;
90 }
91
92 slot.a(itemstack1);
93 }
94
95 return itemstack;
96 }
97}