Notify

模组

· 作者 Krxwallo

你不想为每个项目一遍又一遍地创建用于相同事件的混入。

0 本站下载 0 关注 更新于 2 年前

需要前置:Fabric Language Kotlin、Fabric API

最新 1.3.0 · 1.20.4 · Fabric / Quilt

一键开服(送7天)

?Notify

你是否厌倦了为每个项目重复创建用于相同事件的 mixin?在以前的好日子里,我们只需这样做一次。这就是为什么我们创建了这款出色的库/模组——只需添加一次事件,即可在所有其他项目中使用!

为此,我们使用了 alert,一个极速的事件监听工具。请参阅 alert 的文档 了解如何监听事件。

使用方法

将以下内容添加到你的模组的 build.gradle.kts 文件中:

repositories {
    mavenCentral()
}

dependencies {
    // ...
    
    modImplementation("de.hglabor:notify:1.1.3")
}

然后将 notify 构建好的 jar 文件放入你的 mods 文件夹中。你应该能够像这样订阅事件:

// (在服务器端)
subscribeToEvent<PlayerJoinEvent> {
    logger.info("玩家 ${it.player.name.string} 已加入")
}

当前已实现的事件

客户端的事件订阅尚未测试!(服务器/通用事件 应在服务器上正常工作)

通用
  • PlayerAttackEntityEvent
  • PlayerHungerChangeEvent
  • PlayerItemPickupEvent
  • PlayerPlaceBlockEvent
  • PlayerSlotClickEvent
服务器
  • PlayerBreakBlockEvent
  • PlayerDeathEvent
  • PlayerInteractItemEvent
  • PlayerInteractBlockEvent
  • PlayerItemDropEvent: 当玩家尝试丢弃物品时调用
  • PlayerItemDroppedEvent: 在物品被丢弃后调用
  • PrePlayerJoinEvent: 在玩家加入服务器之前调用
  • PlayerJoinEvent: 当玩家加入服务器时调用。允许修改加入消息
  • PostPlayerJoinEvent: 在玩家加入服务器之后调用
  • PlayerRemoveEvent: 在玩家从玩家列表中移除后调用
  • PlayerQuitEvent: 当玩家离开服务器时调用。允许修改离开消息
  • PlayerSwapHandItemsEvent
  • PlayerTickEvent
  • PlayerSetSettingsEvent: 例如当玩家更改客户端语言时调用
  • EntitySpawnEvent
  • ProjectileHitEvent: 当投射物击中另一个实体时调用
客户端 即将推出™

更多内容请阅读我们的 GitHub 说明文档

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源