-
Notifications
You must be signed in to change notification settings - Fork 755
/
InventoryCraftingStationResult.java
126 lines (110 loc) · 3.04 KB
/
InventoryCraftingStationResult.java
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package tconstruct.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.InventoryCraftResult;
import net.minecraft.item.ItemStack;
import tconstruct.blocks.logic.CraftingStationLogic;
public class InventoryCraftingStationResult extends InventoryCraftResult
{
CraftingStationLogic logic;
public InventoryCraftingStationResult(CraftingStationLogic logic)
{
this.logic = logic;
}
/**
* Returns the number of slots in the inventory.
*/
public int getSizeInventory ()
{
return 1;
}
/**
* Returns the stack in slot i
*/
public ItemStack getStackInSlot (int par1)
{
return logic.getStackInSlot(0);//this.stackResult[0];
}
/**
* Returns the name of the inventory.
*/
public String getInvName ()
{
return "Result";
}
/**
* If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's
* language. Otherwise it will be used directly.
*/
public boolean isInvNameLocalized ()
{
return false;
}
/**
* Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a
* new stack.
*/
public ItemStack decrStackSize (int par1, int par2)
{
ItemStack stack = logic.getStackInSlot(0);
if (stack != null)
{
ItemStack itemstack = stack;
logic.setInventorySlotContents(0, null);
return itemstack;
}
else
{
return null;
}
}
/**
* When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem -
* like when you close a workbench GUI.
*/
public ItemStack getStackInSlotOnClosing (int par1)
{
return null;
}
/**
* Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
*/
@Override
public void setInventorySlotContents (int par1, ItemStack par2ItemStack)
{
logic.setInventorySlotContents(0, par2ItemStack);
}
/**
* Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't
* this more of a set than a get?*
*/
public int getInventoryStackLimit ()
{
return 64;
}
/**
* Called when an the contents of an Inventory change, usually
*/
public void onInventoryChanged ()
{
}
/**
* Do not make give this method the name canInteractWith because it clashes with Container
*/
public boolean isUseableByPlayer (EntityPlayer par1EntityPlayer)
{
return true;
}
public void openChest ()
{
}
public void closeChest ()
{
}
/**
* Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
*/
public boolean isStackValidForSlot (int par1, ItemStack par2ItemStack)
{
return true;
}
}