Class PlayerMainInvWrapper

java.lang.Object
net.neoforged.neoforge.items.wrapper.RangedWrapper
net.neoforged.neoforge.items.wrapper.PlayerMainInvWrapper
All Implemented Interfaces:
IItemHandler, IItemHandlerModifiable

@Deprecated(since="1.21.9", forRemoval=true) public class PlayerMainInvWrapper extends RangedWrapper
Deprecated, for removal: This API element is subject to removal in a future version.
Use PlayerInventoryWrapper instead, in particular PlayerInventoryWrapper.getMainSlots() for the main slots only.
Exposes the player inventory WITHOUT the armor inventory as IItemHandler. Also takes core of inserting/extracting having the same logic as picking up items.
  • Field Details

    • inventoryPlayer

      private final Inventory inventoryPlayer
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Constructor Details

    • PlayerMainInvWrapper

      public PlayerMainInvWrapper(Inventory inv)
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • insertItem

      public ItemStack insertItem(int slot, ItemStack stack, boolean simulate)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: 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)
      Specified by:
      insertItem in interface IItemHandler
      Overrides:
      insertItem in class RangedWrapper
      Parameters:
      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
      Returns:
      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.
    • getInventoryPlayer

      public Inventory getInventoryPlayer()
      Deprecated, for removal: This API element is subject to removal in a future version.