-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCraftingInventoryWorkbenchCB.java
More file actions
79 lines (66 loc) · 2.45 KB
/
CraftingInventoryWorkbenchCB.java
File metadata and controls
79 lines (66 loc) · 2.45 KB
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
69
70
71
72
73
74
75
76
77
78
79
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
public class CraftingInventoryWorkbenchCB extends CraftingInventoryCB
{
public CraftingInventoryWorkbenchCB(InventoryPlayer inventoryplayer, World world, int i, int j, int k)
{
craftMatrix = new InventoryCrafting(this, 3, 3);
craftResult = new InventoryCraftResult();
field_20133_c = world;
field_20132_h = i;
field_20131_i = j;
field_20130_j = k;
func_20117_a(new SlotCrafting(craftMatrix, craftResult, 0, 124, 35));
for(int l = 0; l < 3; l++)
{
for(int k1 = 0; k1 < 3; k1++)
{
func_20117_a(new Slot(craftMatrix, k1 + l * 3, 30 + k1 * 18, 17 + l * 18));
}
}
for(int i1 = 0; i1 < 3; i1++)
{
for(int l1 = 0; l1 < 9; l1++)
{
func_20117_a(new Slot(inventoryplayer, l1 + i1 * 9 + 9, 8 + l1 * 18, 84 + i1 * 18));
}
}
for(int j1 = 0; j1 < 9; j1++)
{
func_20117_a(new Slot(inventoryplayer, j1, 8 + j1 * 18, 142));
}
onCraftMatrixChanged(craftMatrix);
}
public void onCraftMatrixChanged(IInventory iinventory)
{
craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix));
}
public void onCraftGuiClosed(EntityPlayer entityplayer)
{
super.onCraftGuiClosed(entityplayer);
for(int i = 0; i < 9; i++)
{
ItemStack itemstack = craftMatrix.getStackInSlot(i);
if(itemstack != null)
{
entityplayer.dropPlayerItem(itemstack);
}
}
}
public boolean func_20120_b(EntityPlayer entityplayer)
{
if(field_20133_c.getBlockId(field_20132_h, field_20131_i, field_20130_j) != Block.workbench.blockID)
{
return false;
}
return entityplayer.getDistanceSq((double)field_20132_h + 0.5D, (double)field_20131_i + 0.5D, (double)field_20130_j + 0.5D) <= 64D;
}
public InventoryCrafting craftMatrix;
public IInventory craftResult;
private World field_20133_c;
private int field_20132_h;
private int field_20131_i;
private int field_20130_j;
}