整理功能

[!INFO] 注册真源:common/sort/SortHandler.java、common/dropoff/DropOffHandler.java、common/refill/RefillHandler.java

除按键与规则外,本模组还提供 5 项主动功能,全部围绕「物品在容器间的流动」。

1. 槽位整理

common/sort/SortHandler.java 为服务端整理入口;ItemSortContainer 承载实际重排;GuiSortingContext 构建排序上下文(可被第三方 mixin 改写)。ButtonHandler / ButtonPos 决定整理按钮在 GUI 中的绘制位置(默认青色,buttonColor)。

排序期间会播放 sortSound 音效;preventSplit 为真时不拆散已有堆叠。

2. 固定槽位(Pinned Slots)

common/PinnedSlots.java 记录玩家固定的槽位,整理时这些槽位原地不动。状态经 CPlayerPins / SPlayerPins 同步。showPinnedSlotIcon 控制图标显示,样式由 pinnedSlotStyle(默认 STAR_1)与 pinnedSlotIconOffset(默认 PX_1)决定。client/PinnedSlotClient.java 负责客户端渲染。

mixins/early/minecraft/SlotMixin 与 RenderItemPinnedSlotMixin 注入渲染。

3. 投放到目标(Dropoff)

common/dropoff/ 共 10 个类:把指定物品自动投放到坐标处的容器。

  • DropOffHandler 入口,DropOffButtonHandler / DropOffInvButton 为 GUI 按钮
  • DropOffScheduler / DropOffTask 调度与执行
  • InventoryManager / InventoryData 管理目标容器缓存
  • ItemStackComparator 匹配待投放物品,CoinDepositDestination 处理货币投放
  • render/RendererCube / RendererCubeTarget 渲染目标方块框
  • 长按重复由 DropKeyRepeat 配置项 + client/drop/DropKeyRepeatHandler 实现

4. 自动补充(Refill)

common/refill/RefillHandler.java 在物品耐久低于 autoRefillDamageThreshold 时,从背包/固定槽位自动补入同类物品;DamageHelper.java 负责耐久计算。可选来源限定为固定槽位(autoRefillFromPinnedSlots)。音效 SRefillSound。

5. 热键栏交换

common/HotbarSwap.java + CHotbarSwap,由 enableHotbarSwap 控制,用于在整理后把常用物品换到指定热键栏位置。

6. 使用次数指示(Usage Ticker)

client/usageticker/UsageTicker.java 在物品图标上叠加剩余耐久/次数;箭矢类物品有专用处理器 ArrowHandlerRegistry 与兼容实现 VanillaBowHandler、compat/TConstructCompat(Tinkers’ Construct)。由 UsageTicker 配置项(内含 Arrow 子配置)控制。

关联:排序按键 · 物品排序规则 · 配置项