public class ItemHandlerHelper
extends java.lang.Object
Constructor and Description |
---|
ItemHandlerHelper() |
Modifier and Type | Method and Description |
---|---|
static int |
calcRedstoneFromInventory(IItemHandler inv)
This method uses the standard vanilla algorithm to calculate a comparator output for how "full" the inventory is.
|
static boolean |
canItemStacksStack(ItemStack a,
ItemStack b) |
static boolean |
canItemStacksStackRelaxed(ItemStack a,
ItemStack b)
A relaxed version of canItemStacksStack that stacks itemstacks with different metadata if they don't have subtypes.
|
static ItemStack |
copyStackWithSize(ItemStack itemStack,
int size) |
static void |
giveItemToPlayer(PlayerEntity player,
ItemStack stack)
giveItemToPlayer without preferred slot
|
static void |
giveItemToPlayer(PlayerEntity player,
ItemStack stack,
int preferredSlot)
Inserts the given itemstack into the players inventory.
|
static ItemStack |
insertItem(IItemHandler dest,
ItemStack stack,
boolean simulate) |
static ItemStack |
insertItemStacked(IItemHandler inventory,
ItemStack stack,
boolean simulate)
Inserts the ItemStack into the inventory, filling up already present stacks first.
|
@Nonnull public static ItemStack insertItem(IItemHandler dest, @Nonnull ItemStack stack, boolean simulate)
public static boolean canItemStacksStack(@Nonnull ItemStack a, @Nonnull ItemStack b)
public static boolean canItemStacksStackRelaxed(@Nonnull ItemStack a, @Nonnull ItemStack b)
@Nonnull public static ItemStack copyStackWithSize(@Nonnull ItemStack itemStack, int size)
@Nonnull public static ItemStack insertItemStacked(IItemHandler inventory, @Nonnull ItemStack stack, boolean simulate)
public static void giveItemToPlayer(PlayerEntity player, @Nonnull ItemStack stack)
public static void giveItemToPlayer(PlayerEntity player, @Nonnull ItemStack stack, int preferredSlot)
player
- The player to give the item tostack
- The itemstack to insertpublic static int calcRedstoneFromInventory(@Nullable IItemHandler inv)
inv
- The inventory handler to test.