BaublesApi
基本信息
| 属性 |
值 |
| 路径 |
baubles.api.BaublesApi |
| 类型 |
class |
| 包名 |
baubles.api |
方法
| 方法 |
返回值 |
描述 |
getBaubles(EntityPlayer player) |
IInventory |
通过反射调用 baubles.common.lib.PlayerHandler.getPlayerBaubles(EntityPlayer),返回指定玩家的饰品栏 IInventory |
功能
为依赖 Baubles 的其他 mod 提供一个轻量的入口类,避免外部 mod 直接耦合 Baubles 内部实现。
- 内部使用
Class.forName("baubles.common.lib.PlayerHandler").getMethod("getPlayerBaubles", ...),并缓存 Method 对象
- 反射调用失败时通过
FMLLog.warning 记录,并返回 null
- 调用方在拿到
IInventory 后可使用通用的 IInventory 方法访问槽位(如 getSizeInventory、getStackInSlot、isItemValidForSlot 等)
注意事项
相关条目