类 SidedInvWrapper

java.lang.Object
net.minecraftforge.items.wrapper.SidedInvWrapper
所有已实现的接口:
IItemHandler, IItemHandlerModifiable

public class SidedInvWrapper extends Object implements IItemHandlerModifiable
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • create

      public static LazyOptional<IItemHandlerModifiable>[] create(WorldlyContainer inv, Direction... sides)
    • getSlot

      public static int getSlot(WorldlyContainer inv, int slot, @Nullable @Nullable Direction side)
    • equals

      public boolean equals(Object o)
      覆盖:
      equals 在类中 Object
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 Object
    • getSlots

      public int getSlots()
      从接口复制的说明: IItemHandler
      Returns the number of slots available
      指定者:
      getSlots 在接口中 IItemHandler
      返回:
      The number of slots available
    • getStackInSlot

      @NotNull public @NotNull ItemStack getStackInSlot(int slot)
      从接口复制的说明: IItemHandler
      Returns the ItemStack in a given slot. The result's stack size may be greater than the itemstack's max size. If the result is empty, then the slot is empty.

      IMPORTANT: This ItemStack MUST NOT be modified. This method is not for altering an inventory's contents. Any implementers who are able to detect modification through this method should throw an exception.

      SERIOUSLY: DO NOT MODIFY THE RETURNED ITEMSTACK

      指定者:
      getStackInSlot 在接口中 IItemHandler
      参数:
      slot - Slot to query
      返回:
      ItemStack in given slot. Empty Itemstack if the slot is empty.
    • insertItem

      @NotNull public @NotNull ItemStack insertItem(int slot, @NotNull @NotNull ItemStack stack, boolean simulate)
      从接口复制的说明: IItemHandler

      Inserts an ItemStack into the given slot and return the remainder. The ItemStack should not be modified in this function!

      Note: This behaviour is subtly different from IFluidHandler.fill(FluidStack, IFluidHandler.FluidAction)
      指定者:
      insertItem 在接口中 IItemHandler
      参数:
      slot - Slot to insert into.
      stack - ItemStack to insert. This must not be modified by the item handler.
      simulate - If true, the insertion is only simulated
      返回:
      The remaining ItemStack that was not inserted (if the entire stack is accepted, then return an empty ItemStack). May be the same as the input ItemStack if unchanged, otherwise a new ItemStack. The returned ItemStack can be safely modified after.
    • setStackInSlot

      public void setStackInSlot(int slot, @NotNull @NotNull ItemStack stack)
      从接口复制的说明: IItemHandlerModifiable
      Overrides the stack in the given slot. This method is used by the standard Forge helper methods and classes. It is not intended for general use by other mods, and the handler may throw an error if it is called unexpectedly.
      指定者:
      setStackInSlot 在接口中 IItemHandlerModifiable
      参数:
      slot - Slot to modify
      stack - ItemStack to set slot to (may be empty).
    • setInventorySlotContents

      private void setInventorySlotContents(int slot, ItemStack stack)
    • extractItem

      @NotNull public @NotNull ItemStack extractItem(int slot, int amount, boolean simulate)
      从接口复制的说明: IItemHandler
      Extracts an ItemStack from the given slot.

      The returned value must be empty if nothing is extracted, otherwise its stack size must be less than or equal to amount and ItemStack.getMaxStackSize().

      指定者:
      extractItem 在接口中 IItemHandler
      参数:
      slot - Slot to extract from.
      amount - Amount to extract (may be greater than the current stack's max limit)
      simulate - If true, the extraction is only simulated
      返回:
      ItemStack extracted from the slot, must be empty if nothing can be extracted. The returned ItemStack can be safely modified after, so item handlers should return a new or copied stack.
    • getSlotLimit

      public int getSlotLimit(int slot)
      从接口复制的说明: IItemHandler
      Retrieves the maximum stack size allowed to exist in the given slot.
      指定者:
      getSlotLimit 在接口中 IItemHandler
      参数:
      slot - Slot to query.
      返回:
      The maximum stack size allowed in the slot.
    • isItemValid

      public boolean isItemValid(int slot, @NotNull @NotNull ItemStack stack)
      从接口复制的说明: IItemHandler

      This function re-implements the vanilla function Container.canPlaceItem(int, ItemStack). It should be used instead of simulated insertions in cases where the contents and state of the inventory are irrelevant, mainly for the purpose of automation and logic (for instance, testing if a minecart can wait to deposit its items into a full inventory, or if the items in the minecart can never be placed into the inventory and should move on).

      • isItemValid is false when insertion of the item is never valid.
      • When isItemValid is true, no assumptions can be made and insertion must be simulated case-by-case.
      • The actual items in the inventory, its fullness, or any other state are not considered by isItemValid.
      指定者:
      isItemValid 在接口中 IItemHandler
      参数:
      slot - Slot to query for validity
      stack - Stack to test with for validity
      返回:
      true if the slot can insert the ItemStack, not considering the current state of the inventory. false if the slot can never insert the ItemStack in any situation.