Class SidedInventoryFixedWrapper

java.lang.Object
alexiil.mc.lib.attributes.item.compat.InventoryFixedWrapper
alexiil.mc.lib.attributes.item.compat.SidedInventoryFixedWrapper
All Implemented Interfaces:
OpenWrapper, net.minecraft.inventory.Inventory, net.minecraft.inventory.SidedInventory, net.minecraft.util.Clearable

public abstract class SidedInventoryFixedWrapper extends InventoryFixedWrapper implements net.minecraft.inventory.SidedInventory
A SidedInventory that wraps an FixedItemInv.

One of the Inventory methods must be overridden by subclasses however: Inventory.canPlayerUse(PlayerEntity).

  • Constructor Details

    • SidedInventoryFixedWrapper

      public SidedInventoryFixedWrapper(FixedItemInv inv)
      Creates a SidedInventoryFixedWrapper with all of it's slots exposed in every direction.
    • SidedInventoryFixedWrapper

      public SidedInventoryFixedWrapper(FixedItemInv inv, int[][] slotMap)
      Parameters:
      inv - The FixedItemInv to wrap.
      slotMap - The slots to map. There are 3 different possible lengths you can give for this:
      1. Null or 0: Every slot is available from every direction.
      2. 6: Every slot is available from the null direction, and the other slots are direct maps for a Direction.ordinal().
      3. 7: index 0-5 are for their respective Enum.ordinal(), and index 6 is for the null direction.
  • Method Details

    • resetSlotsToAll

      protected void resetSlotsToAll()
      Discards the current availableSlots array and replaces it with one that exposes all slots in every direction.
    • resetSlotsTo

      protected void resetSlotsTo(int[][] slotMap)
      Discards the current availableSlots array and replaces it with the given slot map.
      Parameters:
      slotMap - The slots to map. There are 3 different possible lengths you can give for this:
      1. Null or 0: Every slot is available from every direction.
      2. 6: Every slot is available from the null direction, and the other slots are direct maps for a Direction.ordinal().
      3. 7: index 0-5 are for their respective Enum.ordinal(), and index 6 is for the null direction.
    • getAvailableSlots

      public int[] getAvailableSlots(net.minecraft.util.math.Direction dir)
      Specified by:
      getAvailableSlots in interface net.minecraft.inventory.SidedInventory
    • canInsert

      public boolean canInsert(int slot, net.minecraft.item.ItemStack stack, net.minecraft.util.math.Direction dir)
      Specified by:
      canInsert in interface net.minecraft.inventory.SidedInventory
    • canExtract

      public boolean canExtract(int slot, net.minecraft.item.ItemStack stack, net.minecraft.util.math.Direction dir)
      Specified by:
      canExtract in interface net.minecraft.inventory.SidedInventory