Class FixedInventoryViewVanillaWrapper
java.lang.Object
alexiil.mc.lib.attributes.item.compat.FixedInventoryViewVanillaWrapper
- All Implemented Interfaces:
- Convertible,- AbstractItemInvView,- FixedItemInvView,- OpenWrapper
- Direct Known Subclasses:
- FixedInventoryVanillaWrapper
public class FixedInventoryViewVanillaWrapper
extends Object
implements FixedItemInvView, OpenWrapper
An 
FixedItemInv that wraps a vanilla Inventory.- 
Nested Class SummaryNested classes/interfaces inherited from interface alexiil.mc.lib.attributes.item.AbstractItemInvViewAbstractItemInvView.DefaultChangeTracker
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionnet.minecraft.item.ItemStackgetInvStack(int slot)intgetMaxAmount(int slot, net.minecraft.item.ItemStack stack)intbooleanisItemValidForSlot(int slot, net.minecraft.item.ItemStack item)Checks to see if the given stack would be valid for this slot, ignoring the current contents.wrapInventory(net.minecraft.inventory.Inventory inv)Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface alexiil.mc.lib.attributes.item.AbstractItemInvViewaddListener, getChangeValueMethods inherited from interface alexiil.mc.lib.attributes.item.FixedItemInvViewconvertTo, getFilterForSlot, getFixedView, getGroupedInv, getMappedInv, getSlot, getSubInv, offerSelfAsAttribute, slotIterable, stackIterable
- 
Field Details- 
invprotected final net.minecraft.inventory.Inventory inv
 
- 
- 
Constructor Details- 
FixedInventoryViewVanillaWrapperpublic FixedInventoryViewVanillaWrapper(net.minecraft.inventory.Inventory inv)
 
- 
- 
Method Details- 
wrapInventorypublic static FixedInventoryViewVanillaWrapper wrapInventory(net.minecraft.inventory.Inventory inv)
- 
getSlotCountpublic int getSlotCount()- Specified by:
- getSlotCountin interface- FixedItemInvView
- Returns:
- The number of slots in this inventory.
 
- 
getInvStackpublic net.minecraft.item.ItemStack getInvStack(int slot)- Specified by:
- getInvStackin interface- FixedItemInvView
- Parameters:
- slot- The slot index. Must be a value between 0 (inclusive) and- FixedItemInvView.getSlotCount()(exclusive) to be valid. (Like in arrays, lists, etc).
- Returns:
- The ItemStack that is held in the inventory at the moment. It is unspecified whether you are allowed to
         modify this returned ItemStack- however subinterfaces (likeFixedItemInv) may have different limitations on this. Note that this stack might not be valid for this slot in eitherFixedItemInvView.isItemValidForSlot(int, ItemStack)orFixedItemInvView.getFilterForSlot(int).
 
- 
isItemValidForSlotpublic boolean isItemValidForSlot(int slot, net.minecraft.item.ItemStack item)Description copied from interface:FixedItemInvViewChecks to see if the given stack would be valid for this slot, ignoring the current contents. Note that this method should adhere to the requirements ofItemFilter.matches(ItemStack), so this must not care about theItemStack.getCount(). Passingemptystacks will generally not return useful results.- Specified by:
- isItemValidForSlotin interface- FixedItemInvView
- Parameters:
- slot- The slot index. Must be a value between 0 (inclusive) and- FixedItemInvView.getSlotCount()(exclusive) to be valid. (Like in arrays, lists, etc).
- item- The- ItemStackto check. It's undefined what is returned if an- emptystack is passed in, but it is not generally expected to be useful.
 
- 
getMaxAmountpublic int getMaxAmount(int slot, net.minecraft.item.ItemStack stack)- Specified by:
- getMaxAmountin interface- FixedItemInvView
- Parameters:
- slot- The slot index. Must be a value between 0 (inclusive) and- FixedItemInvView.getSlotCount()(exclusive) to be valid. (Like in arrays, lists, etc).
- stack- The stack to check for. May be an- emptystack to get the maximum amount that this can hold of any stack.
- Returns:
- The maximum amount that the given slot can hold of the given stack. This method will ignore the current
         stack in FixedItemInvView.getInvStack(int). The default implementation just delegates toItemStack.getMaxCount(). Note that any setters that this object implements (likeFixedItemInv.setInvStack(int, ItemStack, Simulation)should reject stacks that are greater than this value. (and callers should only call this if they need to check the amounts separately. Note that it is meaningless to return values greater than the maximum amount an item can be stacked to here, and callers are free to throw an exception if this is violated. (Basically huge single-slot inventories shouldn't implement this interface).
 
- 
getWrapped- Specified by:
- getWrappedin 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 InventorytoFixedItemInvViewwrapper (FixedInventoryViewVanillaWrapper) implements this to return theInventory, but theSidedInventoryvariant (FixedSidedInventoryVanillaWrapper) returns null, as it is not possible to cleanly open the original inventory without exposing additional slots.
 
 
-