e418
The e418 mod is a library tool that allows creating gameplay events using a data-driven approach. This means you can configure various game scenarios without the need to write complex code.
Here's a specific example of how to define an event through configuration data:
{
"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 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": []
}
Usage as dependency
Although this library can work independently as a foundation for addons with datapacks, you can also integrate it into your mods. For developing cross-platform additions, the optimal choice is the Architectury architecture.
To connect the module, add the version string to the gradle.properties file:
e418_version=0.0.2
Then specify the jitpack repository and Gradle dependencies:
// In root build.gradle
repositories {
maven {
url = "https://jitpack.io/"
// Note: First build with JitPack may take longer
}
}
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}"
}