Class BaseItemStackHandler.Builder

java.lang.Object
org.moddingx.libx.inventory.BaseItemStackHandler.Builder
Enclosing class:
BaseItemStackHandler

public static class BaseItemStackHandler.Builder extends Object
Builder for a BaseItemStackHandler
  • Method Details

    • contentsChanged

      public BaseItemStackHandler.Builder contentsChanged(Runnable action)
      Adds an action that runs whenever the contents of the inventory change.
    • contentsChanged

      public BaseItemStackHandler.Builder contentsChanged(Consumer<Integer> action)
      Adds an action that runs whenever the contents of the inventory change. The action will get passed the slot that was changed.
    • output

      public BaseItemStackHandler.Builder output(int... slots)
      Marks the given slots as outputs. That means it's not possible to insert items into these slots. Marking a slot as insertion only and output at the same time will cause an exception.
    • output

      public BaseItemStackHandler.Builder output(Set<Integer> slots)
      Marks the given slots as outputs. That means it's not possible to insert items into these slots. Marking a slot as insertion only and output at the same time will cause an exception.
    • output

      public BaseItemStackHandler.Builder output(Range<Integer> slots)
      Marks the given slots as outputs. That means it's not possible to insert items into these slots. Marking a slot as insertion only and output at the same time will cause an exception.
    • insertionOnly

      public BaseItemStackHandler.Builder insertionOnly(int... slots)
      Marks the given slots as insertion only. That means it's not possible to extract items from these slots. Marking a slot as insertion only and output at the same time will cause an exception.
    • insertionOnly

      public BaseItemStackHandler.Builder insertionOnly(Set<Integer> slots)
      Marks the given slots as insertion only. That means it's not possible to extract items from these slots. Marking a slot as insertion only and output at the same time will cause an exception.
    • insertionOnly

      public BaseItemStackHandler.Builder insertionOnly(Range<Integer> slots)
      Marks the given slots as insertion only. That means it's not possible to extract items from these slots. Marking a slot as insertion only and output at the same time will cause an exception.
    • defaultSlotLimit

      public BaseItemStackHandler.Builder defaultSlotLimit(int defaultSlotLimit)
      Sets the default maximum stack size for the item handler.
    • slotLimit

      public BaseItemStackHandler.Builder slotLimit(int slotLimit, int... slots)
      Sets a maximum stack size for some slots.
    • slotLimit

      public BaseItemStackHandler.Builder slotLimit(int slotLimit, Set<Integer> slots)
      Sets a maximum stack size for some slots.
    • slotLimit

      public BaseItemStackHandler.Builder slotLimit(int slotLimit, Range<Integer> slots)
      Sets a maximum stack size for some slots.
    • validator

      public BaseItemStackHandler.Builder validator(Predicate<net.minecraft.world.item.ItemStack> validator, int... slots)
      Sets a slot validator for some slots.
    • validator

      public BaseItemStackHandler.Builder validator(Predicate<net.minecraft.world.item.ItemStack> validator, Set<Integer> slots)
      Sets a slot validator for some slots.
    • validator

      public BaseItemStackHandler.Builder validator(Predicate<net.minecraft.world.item.ItemStack> validator, Range<Integer> slots)
      Sets a slot validator for some slots.
    • build

      public BaseItemStackHandler build()
      Build the item handler.