mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-09 04:10:31 +01:00
123 lines
4.2 KiB
Groovy
123 lines
4.2 KiB
Groovy
plugins {
|
|
id 'java'
|
|
id 'application'
|
|
// Used to download our data
|
|
id 'de.undercouch.download'
|
|
}
|
|
|
|
group 'net.minestom.server'
|
|
version '1.0'
|
|
|
|
sourceCompatibility = 1.11
|
|
|
|
def mcVersion = "1.16.5"
|
|
def mcVersionUnderscored = mcVersion.replace('.', '_')
|
|
def dataDest = new File(project.projectDir, "/data/")
|
|
def dataDestTags = new File(project.projectDir, "/data/tags/")
|
|
def dataDestLootTable = new File(project.projectDir, "/data/loot_tables/")
|
|
|
|
application {
|
|
mainClass.set("net.minestom.codegen.Generators")
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'com.google.code.gson:gson:2.8.6'
|
|
implementation 'org.jetbrains:annotations:20.1.0'
|
|
implementation 'com.squareup:javapoet:1.13.0'
|
|
// Logging
|
|
implementation 'org.apache.logging.log4j:log4j-core:2.14.0'
|
|
// SLF4J is the base logger for most libraries, therefore we can hook it into log4j2.
|
|
implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.14.0'
|
|
// Kotlin stuff
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${project.kotlinVersion}"
|
|
implementation "org.jetbrains.kotlin:kotlin-reflect:${project.kotlinVersion}"
|
|
}
|
|
|
|
// UPDATE: Update the data to the required version and run the code generator.
|
|
task downloadData(type: Download) {
|
|
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/$mcVersion/${mcVersionUnderscored}_"
|
|
src([
|
|
// attributes.json
|
|
"${mainURL}attributes.json",
|
|
// biomes.json
|
|
"${mainURL}biomes.json",
|
|
// block_entities
|
|
"${mainURL}block_entities.json",
|
|
// block_properties
|
|
"${mainURL}block_properties.json",
|
|
// blocks.json
|
|
"${mainURL}blocks.json",
|
|
// custom_statistics.json
|
|
"${mainURL}custom_statistics.json",
|
|
// dimension_types.json
|
|
"${mainURL}dimension_types.json",
|
|
// enchantments.json
|
|
"${mainURL}enchantments.json",
|
|
// fluids.json
|
|
"${mainURL}fluids.json",
|
|
// items.json
|
|
"${mainURL}items.json",
|
|
// map_colors.json
|
|
"${mainURL}map_colors.json",
|
|
// particles.json
|
|
"${mainURL}particles.json",
|
|
// potion_effects.json
|
|
"${mainURL}potion_effects.json",
|
|
// potions.json
|
|
"${mainURL}potions.json",
|
|
// sounds.json
|
|
"${mainURL}sounds.json",
|
|
// villager_professions.json
|
|
"${mainURL}villager_professions.json",
|
|
// villager_types.json
|
|
"${mainURL}villager_types.json"
|
|
])
|
|
dest dataDest
|
|
overwrite true
|
|
dependsOn("downloadLootTables")
|
|
dependsOn("downloadTags")
|
|
}
|
|
|
|
task downloadTags(type: Download) {
|
|
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/$mcVersion/${mcVersionUnderscored}_tags/${mcVersionUnderscored}_"
|
|
src([
|
|
// block_tags.json
|
|
"${mainURL}block_tags.json",
|
|
// entity_type_tags.json
|
|
"${mainURL}entity_type_tags.json",
|
|
// fluid_tags.json
|
|
"${mainURL}fluid_tags.json",
|
|
// item_tags.json
|
|
"${mainURL}item_tags.json",
|
|
])
|
|
dest dataDestTags
|
|
overwrite true
|
|
}
|
|
|
|
task downloadLootTables(type: Download) {
|
|
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/$mcVersion/${mcVersionUnderscored}_loot_tables/${mcVersionUnderscored}_"
|
|
src([
|
|
// block_loot_tables.json.json
|
|
"${mainURL}block_loot_tables.json",
|
|
// chest_loot_tables.json
|
|
"${mainURL}chest_loot_tables.json",
|
|
// entity_loot_tables.json
|
|
"${mainURL}entity_loot_tables.json",
|
|
// gameplay_loot_tables.json
|
|
"${mainURL}gameplay_loot_tables.json",
|
|
])
|
|
dest dataDestLootTable
|
|
overwrite true
|
|
}
|
|
|
|
|
|
run {
|
|
// Update version
|
|
setArgs(
|
|
List.of(
|
|
mcVersion,
|
|
dataDest.getAbsolutePath(),
|
|
project.rootProject.projectDir.getPath() + "${File.separatorChar}src${File.separatorChar}autogenerated${File.separatorChar}java")
|
|
)
|
|
dependsOn(downloadData)
|
|
} |