ArchieItemMenuSlot¶
class ArchieItemMenuSlot(
storage: ArchieItemStorage,
val filter: Predicate<ItemStack> = Predicate { true },
slot: Int,
x: Int,
y: Int,
owningMenu: ComposeContainerMenuBase<*>
) : Slot
A vanilla Slot that bridges one slot of an ArchieItemStorage into a ComposeContainerMenuBase, so net.minecraft.world.inventory machinery (shift-click, drag, etc.) can operate on it directly. Created by ComposeContainerMenuBase from a handler(group, storage, filter) registration; not usually constructed directly.
Parameters¶
- filter: Restricts which stacks
mayPlaceinto this slot.
Constructors¶
ArchieItemMenuSlot¶
constructor(
storage: ArchieItemStorage,
filter: Predicate<ItemStack> = Predicate { true },
slot: Int,
x: Int,
y: Int,
owningMenu: ComposeContainerMenuBase<*>
)
Parameters
- filter: Restricts which stacks
mayPlaceinto this slot.
Properties¶
container¶
val container: Container?
containerSlot¶
open val containerSlot: Int
filter¶
Parameters
- filter: Restricts which stacks
mayPlaceinto this slot.
index¶
isActive¶
isFake¶
isHighlightable¶
open val isHighlightable: Boolean
item¶
open override val item: ItemStack
maxStackSize¶
open override val maxStackSize: Int
noItemIcon¶
@get:
Nullable
open val noItemIcon: Pair<ResourceLocation?, ResourceLocation?>?
slotIndex¶
x¶
y¶
Functions¶
allowModification¶
open override fun allowModification(player: Player): Boolean
Vanilla's own default (mayPickup(player) && mayPlace(getItem())) is a "can I put this back" round-trip check, not just "can I take this out" - wrong for an output-only slot like this one, where filter deliberately blocks all manual placement (so a player can't shove items into an inbox meant only for network delivery) regardless of what's already sitting there. Left unoverridden, that default would make allowModification permanently false for every item this slot ever holds, since mayPlace(getItem()) for the item already here is still rejected by the same blanket filter - confirmed the hard way: a recipe-viewer mod's own take-from- inventory logic calls allowModification directly, not mayPickup alone, to decide whether a slot is a valid move source, and treated every filled inbox slot as untouchable. Overriding allowModification to only mean mayPickup fixes that without loosening mayPlace itself - real placement (drag, click, hopper insert, ...) still goes through mayPlace unchanged, so a player still can't manually add to a stack already sitting here.
getItem¶
open override fun getItem(): ItemStack
getMaxStackSize¶
open override fun getMaxStackSize(): Int
hasItem¶
isSameInventory¶
open fun isSameInventory(other: Slot?): Boolean
mayPickup¶
mayPlace¶
onQuickCraft¶
open fun onQuickCraft(oldStack: ItemStack?, newStack: ItemStack?)
onTake¶
open fun onTake(player: Player?, stack: ItemStack?)
remove¶
safeInsert¶
open fun safeInsert(stack: ItemStack?): ItemStack?
open fun safeInsert(stack: ItemStack?, increment: Int): ItemStack?
safeTake¶
set¶
open override fun set(stack: ItemStack)
setBackground¶
open fun setBackground(atlas: ResourceLocation?, sprite: ResourceLocation?): Slot?
setByPlayer¶
open fun setByPlayer(stack: ItemStack?)
open fun setByPlayer(newStack: ItemStack?, oldStack: ItemStack?)
setChanged¶
open override fun setChanged()