Class ResourceHandlerSlot
java.lang.Object
net.minecraft.world.inventory.Slot
net.neoforged.neoforge.world.inventory.StackCopySlot
net.neoforged.neoforge.transfer.item.ResourceHandlerSlot
Base implementation for a
Slot backed by a ResourceHandler<ItemResource>.
Requires the handler to expose a direct mutation function,
such as StacksResourceHandler.set(int, T, int).-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ResourceHandler<ItemResource> private final IndexModifier<ItemResource> -
Constructor Summary
ConstructorsConstructorDescriptionResourceHandlerSlot(ResourceHandler<ItemResource> handler, IndexModifier<ItemResource> slotModifier, int handlerSlot, int xPosition, int yPosition) -
Method Summary
Modifier and TypeMethodDescriptionintintgetMaxStackSize(ItemStack stack) protected ItemStackGets the itemstack from the storage.booleanisSameInventory(Slot other) Checks if the other slot is in the same inventory, by comparing the inventory reference.booleanbooleanvoidonQuickCraft(ItemStack oldStackIn, ItemStack newStackIn) protected voidsetStackCopy(ItemStack stack) Sets the itemstack from the storage.Methods inherited from class StackCopySlot
getItem, remove, set, setChangedMethods inherited from class Slot
allowModification, checkTakeAchievements, getContainerSlot, getNoItemIcon, getSlotIndex, hasItem, isActive, isFake, isHighlightable, onQuickCraft, onSwapCraft, onTake, safeInsert, safeInsert, safeTake, setBackground, setByPlayer, setByPlayer, tryRemove
-
Field Details
-
handler
-
slotModifier
-
-
Constructor Details
-
ResourceHandlerSlot
public ResourceHandlerSlot(ResourceHandler<ItemResource> handler, IndexModifier<ItemResource> slotModifier, int handlerSlot, int xPosition, int yPosition)
-
-
Method Details
-
mayPlace
-
getStackCopy
Description copied from class:StackCopySlotGets the itemstack from the storage.- Specified by:
getStackCopyin classStackCopySlot- Returns:
- the stack in this slot
-
setStackCopy
Description copied from class:StackCopySlotSets the itemstack from the storage.- Specified by:
setStackCopyin classStackCopySlot- Parameters:
stack- the stack to put into this slot
-
onQuickCraft
- Overrides:
onQuickCraftin classSlot
-
getMaxStackSize
public int getMaxStackSize()- Overrides:
getMaxStackSizein classSlot
-
getMaxStackSize
- Overrides:
getMaxStackSizein classSlot
-
mayPickup
-
getResourceHandler
-
isSameInventory
Description copied from class:SlotChecks if the other slot is in the same inventory, by comparing the inventory reference.- Overrides:
isSameInventoryin classSlot- Parameters:
other-- Returns:
- true if the other slot is in the same inventory
-