Class ExpandIItemHandler

java.lang.Object
com.blamejared.crafttweaker.natives.capability.ExpandIItemHandler

@ZenRegister public class ExpandIItemHandler extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static IItemStack
    extractItem(net.minecraftforge.items.IItemHandler internal, int slot, int amount, boolean simulate)
    Extract from the given slot.
    static int
    getSlotLimit(net.minecraftforge.items.IItemHandler internal, int slot)
    Gets how much of a stack can fit into the given slot.
    static int
    getSlots(net.minecraftforge.items.IItemHandler internal)
    Gets the amount of slots in the handler.
    static IItemStack
    getStackInSlot(net.minecraftforge.items.IItemHandler internal, int slot)
    Gets the stack in the given slot.
    static IItemStack
    insertItem(net.minecraftforge.items.IItemHandler internal, int slot, IItemStack stack, boolean simulate)
    Inserts the stack into the given slot and returns the remainder.
    static boolean
    isItemValid(net.minecraftforge.items.IItemHandler internal, int slot, IItemStack stack)
    Checks if the given stack is valid for the given slot.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ExpandIItemHandler

      public ExpandIItemHandler()
  • Method Details

    • getSlots

      public static int getSlots(net.minecraftforge.items.IItemHandler internal)
      Gets the amount of slots in the handler.
      Returns:
      The amount of slots in the handler.
    • getStackInSlot

      public static IItemStack getStackInSlot(net.minecraftforge.items.IItemHandler internal, int slot)
      Gets the stack in the given slot.
      Parameters:
      slot - The slot to get the stack of.
      Returns:
      The stack in the slot.
      DocParam:
      slot 1
    • insertItem

      public static IItemStack insertItem(net.minecraftforge.items.IItemHandler internal, int slot, IItemStack stack, boolean simulate)
      Inserts the stack into the given slot and returns the remainder.

      The remainder returned is how much was not inserted.

      For example if slot `0` had `63` dirt, and you tried to insert `5` dirt, you will get a remainder of `4` dirt.

      Parameters:
      slot - The slot to insert into.
      stack - The stack to insert.
      simulate - If the insert should actually happen, if true, will be made.
      Returns:
      The remaining stack that was not inserted.
      DocParam:
      slot 1, stack <item:minecraft:dirt>, simulate true
    • extractItem

      public static IItemStack extractItem(net.minecraftforge.items.IItemHandler internal, int slot, int amount, boolean simulate)
      Extract from the given slot.
      Parameters:
      slot - The slot to extract from.
      amount - How much to extract from the slot.
      simulate - If the extraction should actually happen, if true, no changes will be made.
      Returns:
      The stack extracted from the slot.
      DocParam:
      slot 0, amount 5, simulate false
    • getSlotLimit

      public static int getSlotLimit(net.minecraftforge.items.IItemHandler internal, int slot)
      Gets how much of a stack can fit into the given slot.
      Parameters:
      slot - The slot to check.
      Returns:
      The max stack size of the given stack.
      DocParam:
      slot 1
    • isItemValid

      public static boolean isItemValid(net.minecraftforge.items.IItemHandler internal, int slot, IItemStack stack)
      Checks if the given stack is valid for the given slot.
      Parameters:
      slot - The slot to check.
      stack - The stack to check.
      Returns:
      true if the stack is valid, false otherwise.