e418

e418

[开发中] 一个为数据驱动游戏事件提供支持的库模组。

游戏机制

e418

这是一个为数据驱动的游戏事件提供功能的库模组。

以下是一个数据驱动事件的示例。

{
  "name": "Example event",
  "description": "",
  "behaviours": [
    {
      // Modify context to select a random location around a random player
      "type": "e418:mutate_context",
      "mutators": [
        {
          "type": "e418:select_random_player",
        },
        {
          "type": "e418:select_random_location_around_player",
        },
      ],

      // Run only if the player is below 30 on Y-axis
      "run_conditions": [
        {
          "type": "e418:at_height",
          "below": 30,
        },
      ],

      // Play a cave sound
      "behaviours": [
        {
          "type": "e418:play_sound",
          "sound": "minecraft:ambient.cave",
          "volume": 1.0,
          "pitch": 0.8,
        },
      ],
    },
  ],
  "run_conditions": [],
  "queue_conditions": [],
}

作为依赖项使用

虽然该库可以作为数据包驱动附加内容的驱动,但你也可以使用模组添加自己的内容。

我们建议使用 Architectury 开发多平台附加内容。

在 gradle.properties 中添加版本字符串:

e418_version=0.0.2

添加 jitpack 仓库和依赖项:

// in root build.gradle
repositories {
  maven {
    url = "https://jitpack.io/"
    // Note: JitPack compile times may be slow on first build
  }
}

dependencies {
  // in common/build.gradle
  modImplementation "com.github.5w14.e418:e418-common:${project.e418_version}"

  // in fabric/build.gradle
  modImplementation "com.github.5w14.e418:e418-fabric:${project.e418_version}"

  // in neoforge/build.gradle
  modImplementation "com.github.5w14.e418:e418-neoforge:${project.e418_version}"
}

更多信息请查看 GitHub。