Skip to content
On this page
通用

KattonSlotProviderApi

top.katton.api.dpcallercommon/src/main/kotlin/top/katton/api/dpcaller/KattonSlotProviderApi.kt
从容器槽位中获取物品。

get

get通用函数
kotlin
operator fun Container.get(slot: Int): ItemStack

从容器槽位中获取物品。

set

set通用函数
kotlin
operator fun Container.set(slot: Int, itemStack: ItemStack)

将物品设置到容器槽位中。

minusAssign

minusAssign通用函数
kotlin
operator fun Inventory.minusAssign(itemStack: ItemStack)

从背包中移除物品。

plusAssign

plusAssign通用函数
kotlin
operator fun Inventory.plusAssign(itemStack: ItemStack)

向背包添加物品。

get

get通用函数
kotlin
operator fun SlotProvider.get(slot: KattonItemCollection.KattonItemSlot): ItemStack?

从槽位提供器的 KattonItemSlot 中获取物品。

set

set通用函数
kotlin
operator fun SlotProvider.set(slot: KattonItemCollection.KattonItemSlot, itemStack: ItemStack)

将物品设置到槽位提供器的 KattonItemSlot 中。

get

get通用函数
kotlin
operator fun Container.get(slots: List<KattonItemCollection.KattonItemSlot>): List<ItemStack?>

从容器的多个槽位中获取物品。

slots

slots通用属性
kotlin
val Container.slots: KattonItemCollection

用于访问容器槽位的扩展属性。

KattonItemCollection

KattonItemCollection通用
kotlin
class KattonItemCollection(val container: net.minecraft.world.Container)

提供便捷访问方式的物品槽位集合。

属性

属性说明
container底层 Container。

KattonItemCollection.get

KattonItemCollection.get通用函数
kotlin
operator fun get(slot: KattonItemSlot): SlotAccess?

获取指定槽位的 SlotAccess。

KattonItemCollection.get

KattonItemCollection.get通用函数
kotlin
operator fun get(slots: List<KattonItemSlot>): List<SlotAccess?>

获取多个槽位的 SlotAccess。

KattonItemCollection.KattonItemSlot

KattonItemCollection.KattonItemSlot通用
kotlin
open class KattonItemSlot( val index: Int )

通过索引表示单个物品槽位。

KattonItemCollection.KattonItemSlotGroup

KattonItemCollection.KattonItemSlotGroup通用接口
kotlin
interface KattonItemSlotGroup

物品槽位组接口。

KattonItemCollection.KattonItemSlotList

KattonItemCollection.KattonItemSlotList通用
kotlin
open class KattonItemSlotList( val offset: Int, size: Int ) : Iterable<KattonItemSlot>, KattonItemSlotGroup

连续物品槽位列表。

KattonItemCollection.Contents

KattonItemCollection.Contents通用对象
kotlin
object Contents : KattonItemSlot(0)

第一个内容槽位。

KattonItemCollection.Container

KattonItemCollection.Container通用对象
kotlin
object Container : KattonItemSlotList(0, 54)

全部容器槽位(0-53)。

KattonItemCollection.Hotbar

KattonItemCollection.Hotbar通用对象
kotlin
object Hotbar : KattonItemSlotList(0, 9)

快捷栏槽位(0-8)。

KattonItemCollection.Inventory

KattonItemCollection.Inventory通用对象
kotlin
object Inventory : KattonItemSlotList(9, 27)

主背包槽位(9-35)。

KattonItemCollection.EnderChest

KattonItemCollection.EnderChest通用对象
kotlin
object EnderChest : KattonItemSlotList(200, 27)

末影箱槽位(200-226)。

KattonItemCollection.MobInventory

KattonItemCollection.MobInventory通用对象
kotlin
object MobInventory : KattonItemSlotList(300, 8)

生物背包槽位(300-307)。

KattonItemCollection.Horse

KattonItemCollection.Horse通用对象
kotlin
object Horse : KattonItemSlotList(500, 15)

马背包槽位(500-514)。

KattonItemCollection.Weapon

KattonItemCollection.Weapon通用对象
kotlin
object Weapon : KattonItemSlotGroup

武器槽位(主手和副手)。

KattonItemCollection.Weapon.MainHand

KattonItemCollection.Weapon.MainHand通用对象
kotlin
object MainHand : KattonItemSlot(EquipmentSlot.MAINHAND.getIndex(98))

主手槽位。

KattonItemCollection.Weapon.OffHand

KattonItemCollection.Weapon.OffHand通用对象
kotlin
object OffHand : KattonItemSlot(EquipmentSlot.OFFHAND.getIndex(98))

副手槽位。

KattonItemCollection.Armor

KattonItemCollection.Armor通用对象
kotlin
object Armor : KattonItemSlotGroup

护甲槽位(头盔、胸甲、护腿、靴子)。

KattonItemCollection.Armor.Head

KattonItemCollection.Armor.Head通用对象
kotlin
object Head : KattonItemSlot(EquipmentSlot.HEAD.getIndex(100))

头盔槽位。

KattonItemCollection.Armor.Chest

KattonItemCollection.Armor.Chest通用对象
kotlin
object Chest : KattonItemSlot(EquipmentSlot.CHEST.getIndex(100))

胸甲槽位。

KattonItemCollection.Armor.Legs

KattonItemCollection.Armor.Legs通用对象
kotlin
object Legs : KattonItemSlot(EquipmentSlot.LEGS.getIndex(100))

护腿槽位。

KattonItemCollection.Armor.Feet

KattonItemCollection.Armor.Feet通用对象
kotlin
object Feet : KattonItemSlot(EquipmentSlot.FEET.getIndex(100))

靴子槽位。