public class MalisisSlot
extends java.lang.Object
MalisisInventory| Modifier and Type | Field and Description |
|---|---|
int |
slotNumber
Slot position within its
MalisisInventory. |
protected InventoryState |
state
InventoryState of this slot. |
| Constructor and Description |
|---|
MalisisSlot(int index)
Instantiates a new
MalisisSlot |
MalisisSlot(MalisisInventory inventory,
int index)
Instantiates a new
MalisisSlot |
MalisisSlot(MalisisInventory inventory,
net.minecraft.item.ItemStack itemStack,
int index)
Instantiates a new
MalisisSlot. |
| Modifier and Type | Method and Description |
|---|---|
int |
addItemStackSize(int stackSize)
Adds the item stack size.
|
void |
clearCache(net.minecraft.entity.player.EntityPlayer player)
Clear cache for the
EntityPlayer. |
net.minecraft.item.ItemStack |
extract(int amount)
Extract a specified amount from this
MalisisSlot. |
net.minecraft.item.ItemStack |
getDraggedItemStack()
Gets the dragged item stack.
|
MalisisInventory |
getInventory()
Gets the
MalisisInventory of this MalisisSlot. |
int |
getInventoryId()
|
net.minecraft.item.ItemStack |
getItemStack()
Gets the item stack.
|
int |
getSlotStackLimit()
Gets the maximum stackSize available for this slot.
|
boolean |
hasChanged(net.minecraft.entity.player.EntityPlayer player)
Checks whether this slot has changed for the
EntityPlayer. |
net.minecraft.item.ItemStack |
insert(net.minecraft.item.ItemStack insert)
Inserts an
ItemStack into this MalisisSlot. |
net.minecraft.item.ItemStack |
insert(net.minecraft.item.ItemStack insert,
int amount)
Inserts a specified amount of
ItemStack into this MalisisSlot. |
net.minecraft.item.ItemStack |
insert(net.minecraft.item.ItemStack insert,
int amount,
boolean force)
Inserts a specified amount of
ItemStack into this MalisisSlot. |
boolean |
isEmpty()
Checks if this
MalisisSlot is empty. |
boolean |
isFull()
Checks if this
MalisisSlot can accept more itemStack. |
boolean |
isItemValid(net.minecraft.item.ItemStack itemStack)
Checks if this
MalisisSlot can contain itemStack. |
boolean |
isOutputSlot()
Checks whether this
MalisisSlot is an output slot (if state denies inserts) |
boolean |
isState(int state)
Checks whether this
MalisisSlot is allowed for the state. |
void |
onPickupFromSlot(net.minecraft.entity.player.EntityPlayer player,
net.minecraft.item.ItemStack itemStack)
Called when itemStack is picked up from this
MalisisSlot. |
void |
onSlotChanged()
Called when itemStack is set.
|
void |
register(java.lang.Object object)
Registers an object to inventory changes.
|
void |
setDraggedItemStack(net.minecraft.item.ItemStack itemStack)
Sets the currently dragged ItemStack for this
MalisisSlot. |
void |
setInventory(MalisisInventory inventory)
Sets the inventory containing this
MalisisSlot. |
void |
setItemStack(net.minecraft.item.ItemStack itemStack)
Sets the itemStack contained by this
MalisisSlot. |
int |
setItemStackSize(int stackSize)
Sets the item stack size.
|
void |
setOutputSlot()
Sets this
MalisisSlot as an output slot. |
java.lang.String |
toString() |
void |
updateCache(net.minecraft.entity.player.EntityPlayer player)
|
public int slotNumber
MalisisInventory.protected InventoryState state
InventoryState of this slot.public MalisisSlot(MalisisInventory inventory, net.minecraft.item.ItemStack itemStack, int index)
MalisisSlot.inventory - the inventoryitemStack - the item stackindex - the indexpublic MalisisSlot(MalisisInventory inventory, int index)
MalisisSlotinventory - the inventoryindex - the indexpublic MalisisSlot(int index)
MalisisSlotindex - the indexpublic void register(java.lang.Object object)
object - the objectpublic void setInventory(MalisisInventory inventory)
MalisisSlot.inventory - the new inventorypublic MalisisInventory getInventory()
MalisisInventory of this MalisisSlot.public int getInventoryId()
public void setItemStack(net.minecraft.item.ItemStack itemStack)
MalisisSlot. Does not check for slot validity, max stack size etc...itemStack - the new item stackpublic net.minecraft.item.ItemStack getItemStack()
MalisisSlot.public void setDraggedItemStack(net.minecraft.item.ItemStack itemStack)
MalisisSlot.itemStack - the new dragged item stackpublic net.minecraft.item.ItemStack getDraggedItemStack()
MalisisSlotpublic void setOutputSlot()
MalisisSlot as an output slot. Sets the slot state to deny inserts.public boolean isOutputSlot()
MalisisSlot is an output slot (if state denies inserts)public boolean isState(int state)
MalisisSlot is allowed for the state.state - the stateMalisisInventory and this MalisisSlot allow the state, false otherwise.public boolean isItemValid(net.minecraft.item.ItemStack itemStack)
MalisisSlot can contain itemStack. Defers the test to this inventory.itemStack - the item stackMalisisSlotpublic boolean isFull()
MalisisSlot can accept more itemStack.public boolean isEmpty()
MalisisSlot is empty.public void onSlotChanged()
public void onPickupFromSlot(net.minecraft.entity.player.EntityPlayer player,
net.minecraft.item.ItemStack itemStack)
MalisisSlot.player - the playeritemStack - the item stackpublic int setItemStackSize(int stackSize)
stackSize - the stack sizepublic int addItemStackSize(int stackSize)
stackSize - the stack sizepublic net.minecraft.item.ItemStack extract(int amount)
MalisisSlot.amount - the amountItemStack extractedpublic net.minecraft.item.ItemStack insert(net.minecraft.item.ItemStack insert)
ItemStack into this MalisisSlot.insert - the itemStack to insertpublic net.minecraft.item.ItemStack insert(net.minecraft.item.ItemStack insert,
int amount)
ItemStack into this MalisisSlot.insert - the itemStack to insertamount - the amount to insertpublic net.minecraft.item.ItemStack insert(net.minecraft.item.ItemStack insert,
int amount,
boolean force)
ItemStack into this MalisisSlot.true, the current ItemStack in the slot will be replaced if it cannot be merged.insert - the itemStack to insertamount - the amount to insertforce - whether the itemStack should be forced in the slotpublic int getSlotStackLimit()
inventory.public boolean hasChanged(net.minecraft.entity.player.EntityPlayer player)
EntityPlayer.player - the playerpublic void updateCache(net.minecraft.entity.player.EntityPlayer player)
player - the playerpublic void clearCache(net.minecraft.entity.player.EntityPlayer player)
EntityPlayer.player - the playerpublic java.lang.String toString()
toString in class java.lang.Object