= 创作分享 =
编程开发
1.18.2如何禁用其他模组的部分功能
6371peter

1.18.2如何禁用其他模组的部分功能

6371peter 于 2024-2-14 23:26 ( 2月前 ) [复制链接] [显示全部楼层] [打印]
374 0
100RF
CoFH Core模组ArcheryEvents.java中handleArrowLooseEvent取消了ArrowLooseEvent事件。我用Mixin取消了后续执行
  1. @Mixin(value = ArcheryEvents.class, remap = false)
  2. public class ArcheryEventsMixin {
  3.     @Inject(method = "handleArrowLooseEvent", at = @At("HEAD"), cancellable = true)
  4.     private static void handleArrowLooseEvent(ArrowLooseEvent event, CallbackInfo ci) {
  5.         Player player = event.getPlayer();
  6.         if (CuriosApi.getCuriosHelper().findFirstCurio(player, Registry.ANGELS_SIGHT.get()).isPresent()) ci.cancel();
  7.     }
  8. }
复制代码
是否有更好的办法实现与上述代码相同的功能
发表于 2024-2-14 23:26:07 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式

回复 | 举报

该帖共收到 2 条回复!
百科目前不允许匿名发帖哦~ 请先 [ 登陆 ][ 注册 ] 吧~

本版积分规则

发新帖
  • 回复
  • 点评
  • 评分

[ MC百科(mcmod.cn) 除另有声明,所有开放公共编辑的内容均使用 BY-NC-SA 3.0 协议 ]

Minecraft百科CC协议
快速回复 返回顶部 返回列表