管理者灵魂之匙
基本信息
| 属性 | 值 |
|---|---|
| 注册名 | RandomThings:opSpectreKey |
| 类 | lumien.randomthings.Items.ItemOpSpectreKey(继承 ItemOp) |
| GUI ID | GuiIds.OP_SPECTRE_KEY = 13(GuiIds.java:18) |
| OP 校验周期 | 10 tick |
| 开关 | Items.OpSpectreKey(RTConfiguration.java:221) |
功能
管理者灵魂之匙是灵魂之匙的 OP 权限版:它只对服务器管理员有效,用于多人服务器上让 OP 进出灵魂世界而不需要消耗普通钥匙。
OP 权限强制检查
与普通钥匙不同,本物品的基类 ItemOp 实现了服务端强制回收(Items/ItemOp.java:17-30):
if (worldObj.getTotalWorldTime() % 10 == 0 && !worldObj.isRemote) {
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
if (!MinecraftServer.getServer().getConfigurationManager().func_152596_g(player.getGameProfile())) {
player.inventory.setInventorySlotContents(slot, null);
player.inventoryContainer.detectAndSendChanges();
}
}
}
即每 10 tick 检查一次是否仍为 OP,若已被取消 OP 则直接删除该物品并同步背包。func_152596_g 是 1.7.10 的服务端 OP 判定。
addInformation 追加灰色提示 text.miscellaneous.opOnly(仅管理员)(ItemOp.java:32-35,zh_CN.lang:104)。
权限 GUI
ContainerOpSpectreKey 的 canInteractWith 做同样的 OP 判定(Container/ContainerOpSpectreKey.java:13-22),并在首次交互时向客户端推送灵魂世界数据(RandomThings.instance.spectreHandler.sendData(player))。该容器没有任何槽位 —— 它只是一个权限门。
粒子特效
onUsingTick 的蓄力阈值比普通钥匙短:count < 20(ItemOpSpectreKey.java:33),粒子循环上界为 40 - count(:38)。
数值
| 数值名 | 值 |
|---|---|
| 蓄力阈值 | 20 tick(普通钥匙为 60) |
| 粒子循环上界 | 40 - count |
| OP 校验周期 | 10 tick |
| 容器槽位 | 0 |
| GUI ID | 13 |
交互
| 触发 | 行为 |
|---|---|
| 长按右键蓄力 | 烟雾粒子(比普通钥匙快 3 倍) |
| 非 OP 玩家持有 | 每 10 tick 被自动删除 |
| 右键打开 GUI | 仅 OP 可交互 |
合成配方
无合成配方。 Library/Recipes.java 中 ModItems.opSpectreKey 出现 0 次。本物品只能由服务器 OP 自行取得。