Package net.minecraft.inventory
Class Container
- java.lang.Object
-
- net.zxmushroom63.plugins.BaseData
-
- net.zxmushroom63.plugins.PluginData
-
- net.minecraft.inventory.Container
-
- All Implemented Interfaces:
org.teavm.jso.JSObject
- Direct Known Subclasses:
ContainerBeacon
,ContainerBrewingStand
,ContainerChest
,ContainerDispenser
,ContainerEnchantment
,ContainerFurnace
,ContainerHopper
,ContainerHorseInventory
,ContainerMerchant
,ContainerPlayer
,ContainerRepair
,ContainerWorkbench
public abstract class Container extends PluginData
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.zxmushroom63.plugins.BaseData
BaseData.BooleanCallback, BaseData.BooleanCallbackArr, BaseData.DataBooleanCallback, BaseData.DataBooleanCallbackArr, BaseData.DataDoubleCallback, BaseData.DataDoubleCallbackArr, BaseData.DataFloatCallback, BaseData.DataFloatCallbackArr, BaseData.DataIntCallback, BaseData.DataIntCallbackArr, BaseData.DataObjectCallback, BaseData.DataObjectCallbackArr, BaseData.DataStringCallback, BaseData.DataStringCallbackArr, BaseData.DataVoidCallback, BaseData.DoubleCallback, BaseData.DoubleCallbackArr, BaseData.FloatCallback, BaseData.FloatCallbackArr, BaseData.IntCallback, BaseData.IntCallbackArr, BaseData.ObjectCallback, BaseData.ObjectCallbackArr, BaseData.StringCallback, BaseData.StringCallbackArr, BaseData.VoidCallback
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<ICrafting>
crafters
+ list of all people that need to be notified when this craftinventory changesjava.util.List<ItemStack>
inventoryItemStacks
+ the list of all items(stacks) for the corresponding slotjava.util.List<Slot>
inventorySlots
+ the list of all slots in the inventoryint
windowId
-
Constructor Summary
Constructors Constructor Description Container()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Slot
addSlotToContainer(Slot slotIn)
+ Adds an item slot to this containerstatic int
calcRedstone(TileEntity te)
+ Like the version that takes an inventory.static int
calcRedstoneFromInventory(IInventory inv)
static boolean
canAddItemToSlot(Slot slotIn, ItemStack stack, boolean stackSizeMatters)
+ Checks if it's possible to add the given itemstack to the given slot.boolean
canDragIntoSlot(Slot var1)
+ Returns true if the player can "drag-spilt" items into this slot,.abstract boolean
canInteractWith(EntityPlayer var1)
boolean
canMergeSlot(ItemStack var1, Slot var2)
+ Called to determine if the current slot is valid for the stack merging (double-click) code.static void
computeStackSize(java.util.Set<Slot> parSet, int parInt1, ItemStack parItemStack, int parInt2)
+ Compute the new stack size, Returns the stack with the new size.void
detectAndSendChanges()
+ Looks for changes made in the container, sends them to every listener.boolean
enchantItem(EntityPlayer playerIn, int id)
+ Handles the given Button-click on the server, currently only used by enchanting.static int
extractDragMode(int parInt1)
+ Extracts the drag mode.static int
func_94534_d(int parInt1, int parInt2)
boolean
getCanCraft(EntityPlayer parEntityPlayer)
+ gets whether or not the player can craft in this inventory or notstatic int
getDragEvent(int parInt1)
+ Args : clickedButton, Returns (0 : start drag, 1 : add slot, 2 : end drag)java.util.List<ItemStack>
getInventory()
+ returns a list if itemStacks, for each slot.short
getNextTransactionID(InventoryPlayer parInventoryPlayer)
+ Gets a unique transaction ID.Slot
getSlot(int slotId)
Slot
getSlotFromInventory(IInventory inv, int slotIn)
static boolean
isValidDragMode(int dragModeIn, EntityPlayer player)
void
loadPluginData(BaseData data)
PluginData
makePluginData()
protected boolean
mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean reverseDirection)
+ Merges provided ItemStack with the first avaliable one in the container/player inventor between minIndex (included) and maxIndex (excluded).void
onContainerClosed(EntityPlayer playerIn)
+ Called when the container is closed.void
onCraftGuiOpened(ICrafting listener)
void
onCraftMatrixChanged(IInventory inventoryIn)
+ Callback for when the crafting matrix is changed.void
putStackInSlot(int slotID, ItemStack stack)
+ args: slotID, itemStack to put in slotvoid
putStacksInSlots(ItemStack[] parArrayOfItemStack)
+ places itemstacks in first x slots, x being aitemstack.lenghtvoid
removeCraftingFromCrafters(ICrafting listeners)
+ Remove the given Listener.protected void
resetDrag()
+ Reset the drag fieldsprotected void
retrySlotClick(int i, int j, boolean var3, EntityPlayer entityplayer)
+ Retries slotClick() in case of failurevoid
setCanCraft(EntityPlayer parEntityPlayer, boolean parFlag)
+ sets whether the player can craft in this inventory or notItemStack
slotClick(int slotId, int clickedButton, int mode, EntityPlayer playerIn)
+ Handles slot click.ItemStack
transferStackInSlot(EntityPlayer var1, int i)
+ Take a stack from the specified inventory slot.void
updateProgressBar(int id, int data)
-
Methods inherited from class net.zxmushroom63.plugins.BaseData
execFuncBaseData, execFuncObject, execFuncString, getBaseData, getBaseDataArr, getBoolean, getBooleanArr, getByte, getByteArr, getChar, getCharArr, getDouble, getDoubleArr, getFloat, getFloatArr, getInt, getIntArr, getObject, getObjectArr, getShort, getShortArr, getString, getStringArr, has, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, setCallbackBoolean, setCallbackBooleanArr, setCallbackBooleanArrWithDataArg, setCallbackBooleanWithDataArg, setCallbackDouble, setCallbackDoubleArr, setCallbackDoubleArrWithDataArg, setCallbackDoubleWithDataArg, setCallbackFloat, setCallbackFloatArr, setCallbackFloatArrWithDataArg, setCallbackFloatWithDataArg, setCallbackInt, setCallbackIntArr, setCallbackIntArrWithDataArg, setCallbackIntWithDataArg, setCallbackObject, setCallbackObjectArr, setCallbackObjectArrWithDataArg, setCallbackObjectWithDataArg, setCallbackString, setCallbackStringArr, setCallbackStringArrWithDataArg, setCallbackStringWithDataArg, setCallbackVoid, setCallbackVoidWithDataArg, setNull
-
-
-
-
Field Detail
-
inventoryItemStacks
public java.util.List<ItemStack> inventoryItemStacks
+ the list of all items(stacks) for the corresponding slot
-
inventorySlots
public java.util.List<Slot> inventorySlots
+ the list of all slots in the inventory
-
windowId
public int windowId
-
crafters
protected java.util.List<ICrafting> crafters
+ list of all people that need to be notified when this craftinventory changes
-
-
Method Detail
-
loadPluginData
public void loadPluginData(BaseData data)
-
makePluginData
public PluginData makePluginData()
-
addSlotToContainer
protected Slot addSlotToContainer(Slot slotIn)
+ Adds an item slot to this container
-
onCraftGuiOpened
public void onCraftGuiOpened(ICrafting listener)
-
removeCraftingFromCrafters
public void removeCraftingFromCrafters(ICrafting listeners)
+ Remove the given Listener. Method name is for legacy.
-
getInventory
public java.util.List<ItemStack> getInventory()
+ returns a list if itemStacks, for each slot.
-
detectAndSendChanges
public void detectAndSendChanges()
+ Looks for changes made in the container, sends them to every listener.
-
enchantItem
public boolean enchantItem(EntityPlayer playerIn, int id)
+ Handles the given Button-click on the server, currently only used by enchanting. Name is for legacy.
-
getSlotFromInventory
public Slot getSlotFromInventory(IInventory inv, int slotIn)
-
getSlot
public Slot getSlot(int slotId)
-
transferStackInSlot
public ItemStack transferStackInSlot(EntityPlayer var1, int i)
+ Take a stack from the specified inventory slot.
-
slotClick
public ItemStack slotClick(int slotId, int clickedButton, int mode, EntityPlayer playerIn)
+ Handles slot click.
-
canMergeSlot
public boolean canMergeSlot(ItemStack var1, Slot var2)
+ Called to determine if the current slot is valid for the stack merging (double-click) code. The stack passed in is null for the initial slot that was double-clicked.
-
retrySlotClick
protected void retrySlotClick(int i, int j, boolean var3, EntityPlayer entityplayer)
+ Retries slotClick() in case of failure
-
onContainerClosed
public void onContainerClosed(EntityPlayer playerIn)
+ Called when the container is closed.
-
onCraftMatrixChanged
public void onCraftMatrixChanged(IInventory inventoryIn)
+ Callback for when the crafting matrix is changed.
-
putStackInSlot
public void putStackInSlot(int slotID, ItemStack stack)
+ args: slotID, itemStack to put in slot
-
putStacksInSlots
public void putStacksInSlots(ItemStack[] parArrayOfItemStack)
+ places itemstacks in first x slots, x being aitemstack.lenght
-
updateProgressBar
public void updateProgressBar(int id, int data)
-
getNextTransactionID
public short getNextTransactionID(InventoryPlayer parInventoryPlayer)
+ Gets a unique transaction ID. Parameter is unused.
-
getCanCraft
public boolean getCanCraft(EntityPlayer parEntityPlayer)
+ gets whether or not the player can craft in this inventory or not
-
setCanCraft
public void setCanCraft(EntityPlayer parEntityPlayer, boolean parFlag)
+ sets whether the player can craft in this inventory or not
-
canInteractWith
public abstract boolean canInteractWith(EntityPlayer var1)
-
mergeItemStack
protected boolean mergeItemStack(ItemStack stack, int startIndex, int endIndex, boolean reverseDirection)
+ Merges provided ItemStack with the first avaliable one in the container/player inventor between minIndex (included) and maxIndex (excluded). Args : stack, minIndex, maxIndex, negativDirection. /!\ the Container implementation do not check if the item is valid for the slot
-
extractDragMode
public static int extractDragMode(int parInt1)
+ Extracts the drag mode. Args : eventButton. Return (0 : evenly split, 1 : one item by slot, 2 : not used ?)
-
getDragEvent
public static int getDragEvent(int parInt1)
+ Args : clickedButton, Returns (0 : start drag, 1 : add slot, 2 : end drag)
-
func_94534_d
public static int func_94534_d(int parInt1, int parInt2)
-
isValidDragMode
public static boolean isValidDragMode(int dragModeIn, EntityPlayer player)
-
resetDrag
protected void resetDrag()
+ Reset the drag fields
-
canAddItemToSlot
public static boolean canAddItemToSlot(Slot slotIn, ItemStack stack, boolean stackSizeMatters)
+ Checks if it's possible to add the given itemstack to the given slot.
-
computeStackSize
public static void computeStackSize(java.util.Set<Slot> parSet, int parInt1, ItemStack parItemStack, int parInt2)
+ Compute the new stack size, Returns the stack with the new size. Args : dragSlots, dragMode, dragStack, slotStackSize
-
canDragIntoSlot
public boolean canDragIntoSlot(Slot var1)
+ Returns true if the player can "drag-spilt" items into this slot,. returns true by default. Called to check if the slot can be added to a list of Slots to split the held ItemStack across.
-
calcRedstone
public static int calcRedstone(TileEntity te)
+ Like the version that takes an inventory. If the given TileEntity is not an Inventory, 0 is returned instead.
-
calcRedstoneFromInventory
public static int calcRedstoneFromInventory(IInventory inv)
-
-