Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ayfri/kore
A Kotlin library to generate Datapacks for Minecraft Java.
https://github.com/ayfri/kore
datapack functions kore kotlin-dsl minecraft minecraft-datapack minecraft-kotlin modding modding-tools
Last synced: 12 days ago
JSON representation
A Kotlin library to generate Datapacks for Minecraft Java.
- Host: GitHub
- URL: https://github.com/ayfri/kore
- Owner: Ayfri
- License: gpl-3.0
- Created: 2022-11-13T14:36:08.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-05-22T21:52:41.000Z (6 months ago)
- Last Synced: 2024-05-22T21:52:45.167Z (6 months ago)
- Topics: datapack, functions, kore, kotlin-dsl, minecraft, minecraft-datapack, minecraft-kotlin, modding, modding-tools
- Language: Kotlin
- Homepage: https://kore.ayfri.com
- Size: 3.33 MB
- Stars: 68
- Watchers: 1
- Forks: 3
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
Kore
A Kotlin library to write Datapacks for Minecraft.
This library is compatible and made for Minecraft Java 1.20 and later versions, I don't think I will support older versions nor Bedrock
Edition.
You can still create your own fork and make it compatible with older versions.
I will accept pull requests for older versions on a separate branch.## Getting Started
You can use the [Kore Template](https://github.com/Ayfri/Kore-Template) to start a new project with Kore.
Or install the library by hand with Gradle.
With Kotlin DSL:
```kotlin
implementation("io.github.ayfri.kore:kore:VERSION")
```With Groovy DSL:
```groovy
implementation 'io.github.ayfri.kore:kore:VERSION'
```Then activate the `-Xcontext-receivers` compiler option:
```kotlin
kotlin {
compilerOptions {
freeCompilerArgs.add("-Xcontext-receivers")
}
}
```You should also use Java 21 or higher:
```kotlin
kotlin {
jvmToolchain(21)
}
```Then create a `Main.kt` file and start writing your datapacks.
See the [documentation](https://github.com/Ayfri/Kore/wiki/Creating-a-Datapack) for more information.## Example
```kotlin
fun main() {
val datapack = dataPack("test") {
function("display_text") {
tellraw(allPlayers(), textComponent("Hello World!"))
}recipes {
craftingShaped("enchanted_golden_apple") {
pattern(
"GGG",
"GAG",
"GGG"
)key("G", Items.GOLD_BLOCK)
key("A", Items.APPLE)result(Items.ENCHANTED_GOLDEN_APPLE)
}
}function("tp_random_entity_to_entity") {
val entityName = "test"
val entity = allEntities(limitToOne = true) {
name = entityName
}summon(Entities.CREEPER, vec3(), nbt {
this["CustomName"] = textComponent("Hello World!")
})execute {
asTarget(allEntities {
limit = 3
sort = Sort.RANDOM
})ifCondition {
score(self(), "test") lessThan 10
}run {
teleport(entity)
}
}
}pack {
description = textComponent("Datapack test for ", Color.GOLD) + text("Kore", Color.AQUA) { bold = true }
}
}datapack.generateZip()
}
```## Community Creations
- [SimplEnergyKore](https://github.com/e-psi-lon/SimplEnergyKore)
- [realms-map](https://github.com/Aeltumn/realms-maps)## Features
- DataPack generation.
- Function generation.
- All commands with all subcommands and multiple syntaxes.
- Generation of all JSON-based features of Minecraft (Advancements, Loot Tables, Recipes, ...).
- Selectors.
- NBT tags.
- Chat components.
- Lists for all registries (Blocks, Items, Entities, Advancements, ...).
- Colors/Vector/Rotation/... classes with common operations.
- Macros support.
- Inventory/Scheduler managers.
- Scoreboard display manager (like on servers).
- Debugging system inside commands or functions.
- Common Nbt tags generation (blocks, items, entities, ...).
- OOP module (experimental).> Note: All APIs for commands, selectors, NBT tags, ... are public, so you can use them to create your own features.
## Contributing
If you want to contribute to this project, you can follow these steps:
1. Fork the repository.
2. Run gradle `kore:run` to run the tests.
3. Make your changes.
4. Create a pull request and wait for it to be reviewed and merged.You can also create an issue if you find a bug or if you want to suggest a new feature.
## Support
If you want to support the project, please consider donating !
## License
This project is licensed under the GNU 3.0 License – see the [LICENSE](LICENSE) file for details.