Class IOHelper

java.lang.Object
me.desht.pneumaticcraft.common.util.IOHelper

public class IOHelper extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    countItems(net.minecraftforge.common.util.LazyOptional<net.minecraftforge.items.IItemHandler> cap, Predicate<net.minecraft.world.item.ItemStack> pred)
    Count the number of items in the given handler which match the given predicate
    static net.minecraft.world.item.ItemStack
    extract(net.minecraftforge.items.IItemHandler handler, net.minecraft.world.item.ItemStack requestedStack, IOHelper.ExtractCount countType, boolean simulate, boolean matchNBT)
    Extract a specific number of the given item from the given item handler
    static net.minecraftforge.common.util.LazyOptional<net.minecraftforge.fluids.capability.IFluidHandler>
    getFluidHandlerForTE(net.minecraft.world.level.block.entity.BlockEntity te)
     
    static net.minecraftforge.common.util.LazyOptional<net.minecraftforge.fluids.capability.IFluidHandler>
    getFluidHandlerForTE(net.minecraft.world.level.block.entity.BlockEntity te, net.minecraft.core.Direction facing)
     
    static net.minecraftforge.common.util.LazyOptional<net.minecraftforge.items.IItemHandler>
    getInventoryForTE(net.minecraft.world.level.block.entity.BlockEntity te)
     
    static net.minecraftforge.common.util.LazyOptional<net.minecraftforge.items.IItemHandler>
    getInventoryForTE(net.minecraft.world.level.block.entity.BlockEntity te, net.minecraft.core.Direction facing)
     
    static net.minecraft.world.item.ItemStack
    insert(net.minecraft.world.level.block.entity.BlockEntity tile, net.minecraft.world.item.ItemStack itemStack, boolean simulate)
     
    static net.minecraft.world.item.ItemStack
    insert(net.minecraft.world.level.block.entity.BlockEntity tile, net.minecraft.world.item.ItemStack itemStack, net.minecraft.core.Direction side, boolean simulate)
     
    static net.minecraft.world.item.ItemStack
    insert(net.minecraftforge.common.capabilities.ICapabilityProvider provider, net.minecraft.world.item.ItemStack itemStack, net.minecraft.core.Direction side, boolean simulate)
     
    static void
    insertOrDrop(net.minecraft.world.level.Level world, net.minecraft.world.item.ItemStack stack, net.minecraftforge.items.IItemHandler handler, net.minecraft.world.phys.Vec3 dropPos, boolean simulate)
    Insert an item into an item handler, dropping any excess in the world
    static boolean
    transferOneItem(net.minecraftforge.items.IItemHandler input, net.minecraftforge.items.IItemHandler output)
    Try to transfer a single item between two item handlers

    Methods inherited from class java.lang.Object

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

    • IOHelper

      public IOHelper()
  • Method Details

    • getInventoryForTE

      public static net.minecraftforge.common.util.LazyOptional<net.minecraftforge.items.IItemHandler> getInventoryForTE(net.minecraft.world.level.block.entity.BlockEntity te, net.minecraft.core.Direction facing)
    • getInventoryForTE

      public static net.minecraftforge.common.util.LazyOptional<net.minecraftforge.items.IItemHandler> getInventoryForTE(net.minecraft.world.level.block.entity.BlockEntity te)
    • getFluidHandlerForTE

      public static net.minecraftforge.common.util.LazyOptional<net.minecraftforge.fluids.capability.IFluidHandler> getFluidHandlerForTE(net.minecraft.world.level.block.entity.BlockEntity te, net.minecraft.core.Direction facing)
    • getFluidHandlerForTE

      public static net.minecraftforge.common.util.LazyOptional<net.minecraftforge.fluids.capability.IFluidHandler> getFluidHandlerForTE(net.minecraft.world.level.block.entity.BlockEntity te)
    • extract

      public static net.minecraft.world.item.ItemStack extract(net.minecraftforge.items.IItemHandler handler, net.minecraft.world.item.ItemStack requestedStack, IOHelper.ExtractCount countType, boolean simulate, boolean matchNBT)
      Extract a specific number of the given item from the given item handler
      Parameters:
      handler - the item handler
      requestedStack - the item to search for, including the number of items; this stack is not modified
      countType - how to interpret the item count of requestedStack
      simulate - true if extraction should only be simulated
      matchNBT - if true, require an exact match of item NBT
      Returns:
      the extracted item stack, or ItemStack.EMPTY if nothing was extracted
    • insert

      @Nonnull public static net.minecraft.world.item.ItemStack insert(net.minecraft.world.level.block.entity.BlockEntity tile, net.minecraft.world.item.ItemStack itemStack, boolean simulate)
    • insert

      @Nonnull public static net.minecraft.world.item.ItemStack insert(net.minecraft.world.level.block.entity.BlockEntity tile, net.minecraft.world.item.ItemStack itemStack, net.minecraft.core.Direction side, boolean simulate)
    • insert

      @Nonnull public static net.minecraft.world.item.ItemStack insert(net.minecraftforge.common.capabilities.ICapabilityProvider provider, net.minecraft.world.item.ItemStack itemStack, net.minecraft.core.Direction side, boolean simulate)
    • transferOneItem

      public static boolean transferOneItem(net.minecraftforge.items.IItemHandler input, net.minecraftforge.items.IItemHandler output)
      Try to transfer a single item between two item handlers
      Parameters:
      input - the input handler
      output - the output handler
      Returns:
      true if an item was transferred
    • insertOrDrop

      public static void insertOrDrop(net.minecraft.world.level.Level world, net.minecraft.world.item.ItemStack stack, net.minecraftforge.items.IItemHandler handler, net.minecraft.world.phys.Vec3 dropPos, boolean simulate)
      Insert an item into an item handler, dropping any excess in the world
      Parameters:
      world - the world
      stack - the stack to insert
      handler - the item handler
      dropPos - position to drop excess items at
      simulate - true if only simulating (excess will not be dropped)
    • countItems

      public static int countItems(net.minecraftforge.common.util.LazyOptional<net.minecraftforge.items.IItemHandler> cap, Predicate<net.minecraft.world.item.ItemStack> pred)
      Count the number of items in the given handler which match the given predicate
      Parameters:
      cap - the item handler capability
      pred - a matching predicate
      Returns:
      the number of matching items