跳到正文

punchy-fix

作者:Dreamdawn

add compat with kubejs6 and java

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

Punchy Fix

A Forge 1.20.1‑side client‑only add‑on mod. When a Java‑based mod or KubeJS 6 script calls the player‑arm‑swing method (LivingEntity.swing(), including KubeJS’s player.swing()), this mod makes the closed‑source Punchy mod play its normal‑item‑use interact animation, instead of doing nothing or triggering an attack animation.

Mechanism

  • KubeJS 6’s player.swing() ultimately invokes LivingEntity.swing(hand, true).
  • Punchy itself mixes‑into this method; a normal swing is recorded by Punchy as an attack.
  • This mod intercepts swing() beforehand with a higher‑priority Mixin (priority 1500). If it confirms that the swing is not an attack, mining action, or a tracked item‑use action, it writes a USE_ITEM trigger into Punchy’s UseActionTracker. Once Punchy’s UseItemStateMachine receives this trigger, it will play the normal‑item‑use animation. Punchy’s own swing‑related mixin, upon detecting an existing use trigger, will no‑longer mark this swing as an attack.
  • Guard conditions: Swing echoes occurring within 1 second after a client‑side attack request or a mining request will not be bridged, to prevent genuine attacks / mining actions from being misidentified as item‑use actions. No suppression is applied to item‑use events: every swing() call reaching the client will trigger the use animation, and rapid repeated clicks will be interrupted and restarted by Punchy’s native animation logic.

KubeJS Usage

ItemEvents.rightClick(event=>{
  let player = event.player;
  player.swing();  // Arm‑swing animation will play successfully
})

Calls to player.swing(hand) from any Java mod will also be bridged automatically, requiring no extra API dependency on this mod.

常见问题

punchy-fix 支持哪些 Minecraft 版本?

punchy-fix 支持 Minecraft Java 版 1.20.1,可用的加载器:Forge。下载时注意选择和你游戏版本一致的文件。

punchy-fix 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Forge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。

评论

登录后评论和评分

Dreamdawn 的其他作品

查看全部 →