Cycle Ztone Variants

基本信息

属性 值
默认按键 Left Control
分类 Ztones
注册名 Ztones.keybinding.cycle

功能

按住 Left Control 的同时滚动鼠标滚轮:

  • 在手持 ZtoneGenericItemBlock(即任意 36 个 Ztone 变体方块)时,循环切换 metadata 0–15。
  • 滚轮正向(dwheel > 0)→ 加 1;负向 → 减 1(mod ZtoneType.Variants)。
  • 通过 Ztones.proxy.isVariantCyclingEnabled() 控制;服务端可通过 ConfigurationUpdateMessage 在玩家登录时同步该配置。

客户端处理流程

  1. ClientProxy.processMouseEvent(MouseEvent) 监听 MouseEvent。
  2. 检查 isVariantCyclingEnabledByServer 与 cycleKey.getIsKeyPressed()。
  3. 若当前玩家手持物品为 ZtoneGenericItemBlock,调用 ModNetwork.cycleZtone(entityPlayer, dwheel > 0) 发送 ZtoneCycleMessage(short slot, boolean forward) 到服务端。
  4. 取消事件(event.setCanceled(true))。

服务端处理流程

  1. ZtoneCycleHandler.onMessage 接收消息。
  2. 校验 ModConfiguration.isVariantCyclingEnabled 与玩家手持槽位匹配。
  3. 若手持物为 ZtoneGenericItemBlock,将 metadata = (damage + Variants + offset) % Variants 写回 ItemStack.setItemDamage。

触发条件

  • 玩家必须在主世界手持 Ztone 通用方块,且不在任何 GUI 中(minecraft.currentScreen == null)。
  • 服务器配置必须开启 isVariantCyclingEnabled。

相关条目