Package net.neoforged.neoforge.items
Class ItemHandlerCopySlot
java.lang.Object
net.minecraft.world.inventory.Slot
net.neoforged.neoforge.items.StackCopySlot
net.neoforged.neoforge.items.ItemHandlerCopySlot
Slot class that can be used with immutable
IItemHandler
s
like ComponentItemHandler
.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionItemHandlerCopySlot
(IItemHandler itemHandler, int index, int xPosition, int yPosition) ItemHandlerCopySlot
(SlotItemHandler slotItemHandler) -
Method Summary
Modifier and TypeMethodDescriptionint
int
getMaxStackSize
(ItemStack stack) protected ItemStack
Gets the itemstack from the storage.boolean
isSameInventory
(Slot other) Checks if the other slot is in the same inventory, by comparing the inventory reference.boolean
Return whether this slot's stack can be taken from this slot.boolean
Check if the stack is allowed to be placed in this slot, used for armor slots as well as furnace fuel.void
onQuickCraft
(ItemStack oldStackIn, ItemStack newStackIn) if par2 has more items than par1, onCrafting(item,countIncrease) is calledprotected void
setStackCopy
(ItemStack stack) Sets the itemstack from the storage.Methods inherited from class net.neoforged.neoforge.items.StackCopySlot
getItem, remove, set, setChanged
Methods inherited from class net.minecraft.world.inventory.Slot
allowModification, checkTakeAchievements, getContainerSlot, getNoItemIcon, getSlotIndex, hasItem, isActive, isFake, isHighlightable, onQuickCraft, onSwapCraft, onTake, safeInsert, safeInsert, safeTake, setBackground, setByPlayer, setByPlayer, tryRemove
-
Field Details
-
slotItemHandler
-
-
Constructor Details
-
ItemHandlerCopySlot
-
ItemHandlerCopySlot
-
-
Method Details
-
mayPlace
Description copied from class:Slot
Check if the stack is allowed to be placed in this slot, used for armor slots as well as furnace fuel. -
getStackCopy
Description copied from class:StackCopySlot
Gets the itemstack from the storage.- Specified by:
getStackCopy
in classStackCopySlot
- Returns:
- the stack in this slot
-
setStackCopy
Description copied from class:StackCopySlot
Sets the itemstack from the storage.- Specified by:
setStackCopy
in classStackCopySlot
- Parameters:
stack
- the stack to put into this slot
-
onQuickCraft
Description copied from class:Slot
if par2 has more items than par1, onCrafting(item,countIncrease) is called- Overrides:
onQuickCraft
in classSlot
-
getMaxStackSize
public int getMaxStackSize()- Overrides:
getMaxStackSize
in classSlot
-
getMaxStackSize
- Overrides:
getMaxStackSize
in classSlot
-
mayPickup
Description copied from class:Slot
Return whether this slot's stack can be taken from this slot. -
isSameInventory
Description copied from class:Slot
Checks if the other slot is in the same inventory, by comparing the inventory reference.- Overrides:
isSameInventory
in classSlot
- Parameters:
other
-- Returns:
- true if the other slot is in the same inventory
-
getItemHandler
-