Package-level declarations

Types

Link copied to clipboard
class AnchoredHotbarSwapController(owner: EventListener, inventoryConstraints: InventoryConstraints, swapDelayProvider: () -> Int, anchorHotbarSlotResolver: () -> HotbarItemSlot = { Slots.Hotbar.findSlot { it.isEmpty } ?: Slots.Hotbar[SilentHotbar.serversideSlot] }) : EventListener

Reusable anchored hotbar swap state machine:

Link copied to clipboard
class ArmorItemSlot(equipmentSlot: EquipmentSlot) : ItemSlot
Link copied to clipboard
class ContainerItemSlot(val slotInContainer: Int) : ItemSlot
Link copied to clipboard
open class HotbarItemSlot(val hotbarSlot: Int) : ItemSlot
Link copied to clipboard
sealed interface InventoryAction
Link copied to clipboard

Constraints for inventory actions. This can be used to ensure that the player is not moving or rotating while interacting with the inventory. It Also allows setting delays for opening, clicking and closing the inventory.

Link copied to clipboard
class InventoryItemSlot(inventorySlot: Int) : ItemSlot
Link copied to clipboard

Manages the inventory state and timings and schedules inventory actions

Link copied to clipboard
sealed interface ItemSlot : ItemStackHolder

Represents an inventory slot (e.g. Hotbar Slot 0, OffHand, Chestslot 5, etc.)

Link copied to clipboard
Link copied to clipboard

Additional constraints for the player inventory. This should be used when interacting with the player inventory instead of a generic container.

Link copied to clipboard
sealed class SingleItemStackPickMode : Mode, Predicate<ItemStack>
Link copied to clipboard
class SlotGroup<T : ItemSlot>(val slots: List<T>) : List<T>
Link copied to clipboard
object Slots
Link copied to clipboard
class ViewedInventoryScreen(player: () -> Player?) : Screen
Link copied to clipboard
class VirtualItemSlot(val itemStack: ItemStack, val slotType: ItemSlot.Type, val id: Int) : ItemSlot

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val AbstractContainerMenu.isPlayerInventory: Boolean
Link copied to clipboard
val AbstractContainerScreen<*>?.syncId: Int
Link copied to clipboard
val AbstractContainerMenu.typeOrNull: MenuType<*>?

Functions

Link copied to clipboard
fun <T : ItemSlot> Iterable<T>.findBestToolToMineBlock(blockState: BlockState, ignoreDurability: Boolean = true, predicate: BiPredicate<ItemStack, BlockState> = BiPredicate { _, _ -> true }): T?

Finds the best slot in this iterable for mining blockState using mc.player as baseline.

Link copied to clipboard
inline fun <T : HotbarItemSlot> SlotGroup<T>.findClosestSlot(predicate: (ItemStack) -> Boolean): T?
fun <T : HotbarItemSlot> SlotGroup<T>.findClosestSlot(item: Item): T?
fun <T : HotbarItemSlot> SlotGroup<T>.findClosestSlot(vararg items: Item): T?
Link copied to clipboard
fun AbstractContainerScreen<*>.findItemsInContainer(): List<ContainerItemSlot>
Link copied to clipboard
fun AbstractContainerScreen<*>.getSlotsInContainer(): List<ContainerItemSlot>
Link copied to clipboard
Link copied to clipboard
fun SlotGroup<*>.hasItem(item: Item): Boolean
Link copied to clipboard
context(requester: EventListener)
fun useHotbarSlotOrOffhand(slot: HotbarItemSlot, ticksUntilReset: Int = 1, yRot: Float = RotationManager.currentRotation?.yRot ?: player.yRot, xRot: Float = RotationManager.currentRotation?.xRot ?: player.xRot, swingMode: SwingMode = SwingMode.DO_NOT_HIDE): InteractionResult