Class InventoryModifiableResourceHandlerNeoForge

java.lang.Object
org.cyclops.cyclopscore.inventory.InventoryModifiableResourceHandlerNeoForge
All Implemented Interfaces:
org.cyclops.cyclopscore.inventory.IInventoryCommonModifiable

public class InventoryModifiableResourceHandlerNeoForge extends Object implements org.cyclops.cyclopscore.inventory.IInventoryCommonModifiable
An IInventoryCommonModifiable that is backed by a ResourceHandler of items.
  • Constructor Details

    • InventoryModifiableResourceHandlerNeoForge

      public InventoryModifiableResourceHandlerNeoForge(net.neoforged.neoforge.transfer.ResourceHandler<net.neoforged.neoforge.transfer.item.ItemResource> resourceHandler)
  • Method Details

    • getSlots

      public int getSlots()
      Specified by:
      getSlots in interface org.cyclops.cyclopscore.inventory.IInventoryCommonModifiable
    • getStackInSlot

      public net.minecraft.world.item.ItemStack getStackInSlot(int slot)
      Specified by:
      getStackInSlot in interface org.cyclops.cyclopscore.inventory.IInventoryCommonModifiable
    • setStackInSlot

      public void setStackInSlot(int slot, net.minecraft.world.item.ItemStack itemStack)
      The transfer API has no slot setter, so the slot is emptied and refilled in one transaction. Unlike a plain setter, this respects the handler's own slot validation: if the slot refuses (part of) the stack, the transaction is rolled back and the slot is left as it was, rather than dropping the items.
      Specified by:
      setStackInSlot in interface org.cyclops.cyclopscore.inventory.IInventoryCommonModifiable