Package net.neoforged.neoforge.items
Class StackCopySlot
java.lang.Object
net.minecraft.world.inventory.Slot
net.neoforged.neoforge.items.StackCopySlot
- Direct Known Subclasses:
ItemHandlerCopySlot
Slot to handle immutable itemstack storages (Ex:
ComponentItemHandler
).
For an implementation for use with an IItemHandler
see ItemHandlerCopySlot
.
Vanilla MC code modifies the stack returned by `getStack()` 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 net.minecraft.world.inventory.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:
setChanged
in classSlot
-
remove
-