IBauble

基本信息

属性 值
路径 baubles.api.IBauble
类型 interface
作者 Azanor
包名 baubles.api

抽象方法

方法 用途
BaubleType getBaubleType(ItemStack itemstack) 返回饰品所属类型;用于决定能放入哪些槽位
void onWornTick(ItemStack itemstack, EntityLivingBase player) 每 tick 当饰品被穿戴时调用一次
void onEquipped(ItemStack itemstack, EntityLivingBase player) 当玩家装备该饰品时调用
void onUnequipped(ItemStack itemstack, EntityLivingBase player) 当饰品被卸下时调用
boolean canEquip(ItemStack itemstack, EntityLivingBase player) 是否允许装入饰品栏
boolean canUnequip(ItemStack itemstack, EntityLivingBase player) 是否允许从饰品栏卸下

默认方法

方法 默认行为
void onPlayerLoad(ItemStack itemstack, EntityLivingBase player) 空实现;玩家登录/跨维度时触发,便于 bauble 内部状态恢复

功能

原始 Baubles 提供的饰品接口。任何想让物品可装备到 Baubles 槽位的物品都必须实现此接口。

  • 在 Baubles-Expanded 中,可以选择升级到 IBaubleExpanded 来支持多类型与扩展槽位
  • 若物品只实现 IBauble,其槽位类型由 getBaubleType 返回的 BaubleType 决定
  • onPlayerLoad 的默认实现为空,仅在服务器玩家登录或跨维度时由 EventHandlerNetwork / PacketSyncAllBauble 触发

配套基类

  • BaubleItemBase - 抽象基类,给出 IBaubleExpanded 的默认实现

相关条目