Class StackCopySlot
java.lang.Object
net.minecraft.world.inventory.Slot
net.neoforged.neoforge.world.inventory.StackCopySlot
- Direct Known Subclasses:
ItemHandlerCopySlot, ResourceHandlerSlot
Slot to handle immutable itemstack storages (Ex:
ItemAccessItemHandler).
For an implementation for use with a ResourceHandler see ResourceHandlerSlot.
Vanilla MC code modifies the stack returned by getItem() directly, but it
calls setChanged() when that happens, so we just cache the returned stack,
and set it when setChanged() is called.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class Slot
allowModification, checkTakeAchievements, getContainerSlot, getMaxStackSize, getMaxStackSize, getNoItemIcon, getSlotIndex, hasItem, isActive, isFake, isHighlightable, isSameInventory, mayPickup, mayPlace, onQuickCraft, onQuickCraft, onSwapCraft, onTake, safeInsert, safeInsert, safeTake, setBackground, setByPlayer, setByPlayer, tryRemove
-
Field Details
-
emptyInventory
-
cachedReturnedStack
-
-
Constructor Details
-
StackCopySlot
public StackCopySlot(int x, int y)
-
-
Method Details
-
getStackCopy
Gets the itemstack from the storage.- Returns:
- the stack in this slot
-
setStackCopy
Sets the itemstack from the storage.- Parameters:
stack- the stack to put into this slot
-
getItem
-
set
-
setChanged
public final void setChanged()- Overrides:
setChangedin classSlot
-
remove
-