public class Slot
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
IInventory |
inventory
The inventory we want to extract a slot from.
|
private int |
slotIndex
The index of the slot in the inventory.
|
int |
slotNumber
the id of the slot(also the index in the inventory arraylist)
|
int |
xDisplayPosition
display position of the inventory slot on the screen x axis
|
int |
yDisplayPosition
display position of the inventory slot on the screen y axis
|
Constructor and Description |
---|
Slot(IInventory inventoryIn,
int index,
int xPosition,
int yPosition) |
Modifier and Type | Method and Description |
---|---|
boolean |
canBeHovered()
Actualy only call when we want to render the white square effect over the slots.
|
boolean |
canTakeStack(EntityPlayer playerIn)
Return whether this slot's stack can be taken from this slot.
|
ItemStack |
decrStackSize(int amount)
Decrease the size of the stack in slot (first int arg) by the amount of the second int arg.
|
boolean |
getHasStack()
Returns if this slot contains a stack.
|
int |
getItemStackLimit(ItemStack stack) |
int |
getSlotStackLimit()
Returns the maximum stack size for a given slot (usually the same as getInventoryStackLimit(), but 1 in the case
of armor slots)
|
java.lang.String |
getSlotTexture() |
ItemStack |
getStack()
Helper fnct to get the stack in the slot.
|
boolean |
isHere(IInventory inv,
int slotIn)
returns true if the slot exists in the given inventory and location
|
boolean |
isItemValid(ItemStack stack)
Check if the stack is a valid item for this slot.
|
protected void |
onCrafting(ItemStack stack)
the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
|
protected void |
onCrafting(ItemStack stack,
int amount)
the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
|
void |
onPickupFromSlot(EntityPlayer playerIn,
ItemStack stack) |
void |
onSlotChange(ItemStack p_75220_1_,
ItemStack p_75220_2_)
if par2 has more items than par1, onCrafting(item,countIncrease) is called
|
void |
onSlotChanged()
Called when the stack in a Slot changes
|
void |
putStack(ItemStack stack)
Helper method to put a stack in the slot.
|
private final int slotIndex
public final IInventory inventory
public int slotNumber
public int xDisplayPosition
public int yDisplayPosition
public Slot(IInventory inventoryIn, int index, int xPosition, int yPosition)
public void onSlotChange(ItemStack p_75220_1_, ItemStack p_75220_2_)
protected void onCrafting(ItemStack stack, int amount)
protected void onCrafting(ItemStack stack)
public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack)
public boolean isItemValid(ItemStack stack)
public ItemStack getStack()
public boolean getHasStack()
public void putStack(ItemStack stack)
public void onSlotChanged()
public int getSlotStackLimit()
public int getItemStackLimit(ItemStack stack)
public java.lang.String getSlotTexture()
public ItemStack decrStackSize(int amount)
public boolean isHere(IInventory inv, int slotIn)
public boolean canTakeStack(EntityPlayer playerIn)
public boolean canBeHovered()