SlotBauble

基本信息

属性 值
路径 baubles.common.container.SlotBauble
类型 class
父类 Slot
包名 baubles.common.container

构造

构造 用途
SlotBauble(IInventory, BaubleType, slot, x, y)(已废弃) 旧版基于 enum 的构造;内部用 BaubleExpandedSlots.getTypeFromBaubleType 转字符串
SlotBauble(IInventory, String type, slot, x, y) 新版构造;type 来自 BaubleExpandedSlots 的注册类型字符串(null 时使用 unknownType)

字段

字段 类型 说明
slotType final String 此槽位的扩展类型

方法

方法 行为
getSlotType 返回槽位类型字符串
isItemValid(stack) 要求 stack 实现 IBauble 且 canEquip 返回 true;然后用 IBaubleExpanded.getBaubleTypes 或 IBauble.getBaubleType 转字符串数组,与 slotType 通过 BaublesConfig.canTypeFitSlot 匹配
onSlotChanged 调用 IBaubleExpanded.onSlotContentsChanged(仅当物品是扩展接口实现且 inventory 是 InventoryBaubles)
canTakeStack(player) 仅当 IBauble.canUnequip 返回 true
getSlotStackLimit 返回 BaublesConfig.getStackLimitForSlotType(默认 1)
getBackgroundIconIndex(client only) unknownType 且未启用旧 GUI 时返回 null;否则从 ItemDebugger 拿到对应类型的空槽位贴图

匹配规则(isItemValid)

  1. stack 为 null → false
  2. 不是 IBauble 或 canEquip=false → false
  3. 取物品类型列表(扩展接口走 getBaubleTypes,否则 enum 转字符串)
  4. 任意一项类型满足 BaublesConfig.canTypeFitSlot(type, slotType) → true;否则 false

相关条目