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)
-
Field Details
-
Constructor Details
-
Method Details
-
clear
public void clear()- Specified by:
clear
in interfacenet.minecraft.util.Clearable
-
size
public int size()- Specified by:
size
in interfacenet.minecraft.inventory.Inventory
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfacenet.minecraft.inventory.Inventory
-
getStack
public net.minecraft.item.ItemStack getStack(int slot)- Specified by:
getStack
in interfacenet.minecraft.inventory.Inventory
-
removeStack
public net.minecraft.item.ItemStack removeStack(int slot, int amount)- Specified by:
removeStack
in interfacenet.minecraft.inventory.Inventory
-
removeStack
public net.minecraft.item.ItemStack removeStack(int slot)- Specified by:
removeStack
in interfacenet.minecraft.inventory.Inventory
-
setStack
public void setStack(int slot, net.minecraft.item.ItemStack to)- Specified by:
setStack
in interfacenet.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 interfacenet.minecraft.inventory.Inventory
-
markDirty
public void markDirty()- Specified by:
markDirty
in interfacenet.minecraft.inventory.Inventory
-
getWrapped
public java.lang.Object getWrapped()- Specified by:
getWrapped
in interfaceOpenWrapper
- 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
toFixedItemInvView
wrapper (FixedInventoryViewVanillaWrapper
) implements this to return theInventory
, but theSidedInventory
variant (FixedSidedInventoryVanillaWrapper
) returns null, as it is not possible to cleanly open the original inventory without exposing additional slots.
-