Skip to content

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 mayPlace into 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 mayPlace into this slot.

Properties

container

val container: Container?

containerSlot

open val containerSlot: Int

filter

val filter: Predicate<ItemStack>

Parameters

  • filter: Restricts which stacks mayPlace into this slot.

index

var index: Int

isActive

open override fun isActive(): Boolean
open override val isActive: Boolean

isFake

open val isFake: Boolean

isHighlightable

item

open override val item: ItemStack

maxStackSize

open override val maxStackSize: Int

noItemIcon

@get:



Nullable



open val noItemIcon: Pair<ResourceLocation?, ResourceLocation?>?

slotIndex

open val slotIndex: Int

x

var x: Int

y

var y: Int

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

open fun hasItem(): Boolean

isSameInventory

open fun isSameInventory(other: Slot?): Boolean

mayPickup

open fun mayPickup(player: Player?): Boolean

mayPlace

open override fun mayPlace(stack: ItemStack): Boolean

onQuickCraft

open fun onQuickCraft(oldStack: ItemStack?, newStack: ItemStack?)

onTake

open fun onTake(player: Player?, stack: ItemStack?)

remove

open override fun remove(amount: Int): ItemStack

safeInsert

open fun safeInsert(stack: ItemStack?): ItemStack?
open fun safeInsert(stack: ItemStack?, increment: Int): ItemStack?

safeTake

open fun safeTake(
    count: Int, 
    decrement: Int, 
    player: Player?
): ItemStack?

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()

tryRemove

open fun tryRemove(
    count: Int, 
    decrement: Int, 
    player: Player?
): Optional<ItemStack?>?