Class InventoryFixedWrapper

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

public abstract class InventoryFixedWrapper
extends java.lang.Object
implements net.minecraft.inventory.Inventory, OpenWrapper
An Inventory that wraps an FixedItemInv.

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

  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected FixedItemInv inv  
  • Constructor Summary

    Constructors 
    Constructor Description
    InventoryFixedWrapper​(FixedItemInv inv)  
  • Method Summary

    Modifier and Type Method Description
    void clear()  
    net.minecraft.item.ItemStack getStack​(int slot)  
    java.lang.Object getWrapped()  
    boolean isEmpty()  
    boolean isValid​(int slot, net.minecraft.item.ItemStack stack)  
    void markDirty()  
    net.minecraft.item.ItemStack removeStack​(int slot)  
    net.minecraft.item.ItemStack removeStack​(int slot, int amount)  
    void setStack​(int slot, net.minecraft.item.ItemStack to)  
    int size()  
    boolean softSetInvStack​(int slot, net.minecraft.item.ItemStack to)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.minecraft.inventory.Inventory

    canPlayerUse, containsAny, count, getMaxCountPerStack, onClose, onOpen
  • Field Details

  • Constructor Details

  • Method Details

    • clear

      public void clear()
      Specified by:
      clear in interface net.minecraft.util.Clearable
    • size

      public int size()
      Specified by:
      size in interface net.minecraft.inventory.Inventory
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface net.minecraft.inventory.Inventory
    • getStack

      public net.minecraft.item.ItemStack getStack​(int slot)
      Specified by:
      getStack in interface net.minecraft.inventory.Inventory
    • removeStack

      public net.minecraft.item.ItemStack removeStack​(int slot, int amount)
      Specified by:
      removeStack in interface net.minecraft.inventory.Inventory
    • removeStack

      public net.minecraft.item.ItemStack removeStack​(int slot)
      Specified by:
      removeStack in interface net.minecraft.inventory.Inventory
    • setStack

      public void setStack​(int slot, net.minecraft.item.ItemStack to)
      Specified by:
      setStack in interface net.minecraft.inventory.Inventory
    • softSetInvStack

      public boolean softSetInvStack​(int slot, net.minecraft.item.ItemStack to)
    • isValid

      public boolean isValid​(int slot, net.minecraft.item.ItemStack stack)
      Specified by:
      isValid in interface net.minecraft.inventory.Inventory
    • markDirty

      public void markDirty()
      Specified by:
      markDirty in interface net.minecraft.inventory.Inventory
    • getWrapped

      public java.lang.Object getWrapped()
      Specified by:
      getWrapped in interface OpenWrapper
      Returns:
      The object that this wraps, or null if the wrapped object cannot be converted cleanly without exposing additional details.

      For example LBA's Inventory to FixedItemInvView wrapper (FixedInventoryViewVanillaWrapper) implements this to return the Inventory, but the SidedInventory variant (FixedSidedInventoryVanillaWrapper) returns null, as it is not possible to cleanly open the original inventory without exposing additional slots.