public class InventoryUtils
extends java.lang.Object
Constructor and Description |
---|
InventoryUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
calcRedstoneFromInventory(net.minecraftforge.items.IItemHandler inventory)
Calculates the redstone signal to output based on how full an inventory is
|
static boolean |
canStacksMerge(net.minecraft.item.ItemStack stackOne,
net.minecraft.item.ItemStack stackTwo)
Checks if the two stacks can merge
|
static boolean |
moveItemInto(java.lang.Object source,
int fromSlot,
java.lang.Object target,
int intoSlot,
int maxAmount,
net.minecraft.util.Direction dir,
boolean doMove,
boolean checkSidedSource,
boolean checkSidedTarget)
Used to move items from one inventory to another.
|
static boolean |
tryMergeStacks(net.minecraft.item.ItemStack stackToMerge,
net.minecraft.item.ItemStack stackInSlot)
Tries to merge the two stacks
|
public static int calcRedstoneFromInventory(net.minecraftforge.items.IItemHandler inventory)
inventory
- The inventorypublic static boolean canStacksMerge(net.minecraft.item.ItemStack stackOne, net.minecraft.item.ItemStack stackTwo)
stackOne
- The first stackstackTwo
- The second stackpublic static boolean tryMergeStacks(net.minecraft.item.ItemStack stackToMerge, net.minecraft.item.ItemStack stackInSlot)
stackToMerge
- The stack to mergestackInSlot
- The stack to merge intopublic static boolean moveItemInto(java.lang.Object source, int fromSlot, java.lang.Object target, int intoSlot, int maxAmount, net.minecraft.util.Direction dir, boolean doMove, boolean checkSidedSource, boolean checkSidedTarget)
source
- The source inventory, can be IInventory, ISideInventory, or preferably IItemHandlerfromSlot
- The from slot, -1 for anytarget
- The target inventory, can be IInventory, ISideInventory, or preferably IItemHandlerintoSlot
- The slot to move into the target, -1 for anymaxAmount
- The max amount to move/extractdir
- The direction moving into, so the face of the fromInventorydoMove
- True to actually do the move, false to simulate