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 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 inherited from interface net.minecraft.inventory.Inventory
MAX_COUNT_PER_STACK
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
net.minecraft.item.ItemStack
getStack
(int slot) boolean
isEmpty()
boolean
isValid
(int slot, net.minecraft.item.ItemStack stack) void
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
-
inv
-
-
Constructor Details
-
InventoryFixedWrapper
-
-
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
- 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.
-