mirror of
https://github.com/Minestom/Minestom.git
synced 2025-03-13 07:09:51 +01:00
Download data to the correct directory and remove redundancy.
This commit is contained in:
parent
36d2834b18
commit
042311d5e3
4
.gitignore
vendored
4
.gitignore
vendored
@ -59,5 +59,5 @@ gradle-app.setting
|
|||||||
# When compiling we get a docs folder
|
# When compiling we get a docs folder
|
||||||
**/docs
|
**/docs
|
||||||
|
|
||||||
# The data for generation is included in this folder
|
# The data for generation and the resources is included in this folder
|
||||||
code-generators/data/
|
src/main/resources
|
||||||
|
45
build.gradle
45
build.gradle
@ -219,9 +219,26 @@ configurations.all {
|
|||||||
exclude group: "org.checkerframework", module: "checker-qual"
|
exclude group: "org.checkerframework", module: "checker-qual"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
dependsOn("downloadResources")
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
mavenJava(MavenPublication) {
|
||||||
|
from components.java
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def mcVersionUnderscored = mcVersion.replace('.', '_')
|
||||||
|
def dataDest = new File(project.projectDir, "/src/main/resources/minecraft_data/")
|
||||||
|
def dataDestTags = new File(project.projectDir, "/src/main/resources/minecraft_data/tags")
|
||||||
|
def dataDestLootTable = new File(project.projectDir, "/src/main/resources/minecraft_data/loot_tables")
|
||||||
|
|
||||||
// UPDATE: Update the data to the required version
|
// UPDATE: Update the data to the required version
|
||||||
task downloadData(type: Download) {
|
task downloadResources(type: Download) {
|
||||||
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/1.16.5/1_16_5_";
|
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/$mcVersion/${mcVersionUnderscored}_"
|
||||||
src([
|
src([
|
||||||
// attributes.json
|
// attributes.json
|
||||||
"${mainURL}attributes.json",
|
"${mainURL}attributes.json",
|
||||||
@ -258,12 +275,14 @@ task downloadData(type: Download) {
|
|||||||
// villager_types.json
|
// villager_types.json
|
||||||
"${mainURL}villager_types.json"
|
"${mainURL}villager_types.json"
|
||||||
])
|
])
|
||||||
dest new File(processResources.destinationDir, "/minecraft_data/")
|
dest dataDest
|
||||||
overwrite true
|
overwrite true
|
||||||
|
dependsOn("downloadLootTables")
|
||||||
|
dependsOn("downloadTags")
|
||||||
}
|
}
|
||||||
|
|
||||||
task downloadTags(type: Download) {
|
task downloadTags(type: Download) {
|
||||||
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/1.16.5/1_16_5_tags/1_16_5_";
|
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/$mcVersion/${mcVersionUnderscored}_tags/${mcVersionUnderscored}_"
|
||||||
src([
|
src([
|
||||||
// block_tags.json
|
// block_tags.json
|
||||||
"${mainURL}block_tags.json",
|
"${mainURL}block_tags.json",
|
||||||
@ -274,12 +293,12 @@ task downloadTags(type: Download) {
|
|||||||
// item_tags.json
|
// item_tags.json
|
||||||
"${mainURL}item_tags.json",
|
"${mainURL}item_tags.json",
|
||||||
])
|
])
|
||||||
dest new File(processResources.destinationDir, "/minecraft_data/tags/")
|
dest dataDestTags
|
||||||
overwrite true
|
overwrite true
|
||||||
}
|
}
|
||||||
|
|
||||||
task downloadLootTables(type: Download) {
|
task downloadLootTables(type: Download) {
|
||||||
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/1.16.5/1_16_5_loot_tables/1_16_5_";
|
String mainURL = "https://raw.githubusercontent.com/Minestom/MinestomDataGenerator/master/Minestom-data/$mcVersion/${mcVersionUnderscored}_loot_tables/${mcVersionUnderscored}_"
|
||||||
src([
|
src([
|
||||||
// block_loot_tables.json.json
|
// block_loot_tables.json.json
|
||||||
"${mainURL}block_loot_tables.json",
|
"${mainURL}block_loot_tables.json",
|
||||||
@ -290,18 +309,6 @@ task downloadLootTables(type: Download) {
|
|||||||
// gameplay_loot_tables.json
|
// gameplay_loot_tables.json
|
||||||
"${mainURL}gameplay_loot_tables.json",
|
"${mainURL}gameplay_loot_tables.json",
|
||||||
])
|
])
|
||||||
dest new File(processResources.destinationDir, "/minecraft_data/loot_tables/")
|
dest dataDestLootTable
|
||||||
overwrite true
|
overwrite true
|
||||||
}
|
|
||||||
|
|
||||||
processResources {
|
|
||||||
dependsOn(downloadData, downloadTags, downloadLootTables)
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
mavenJava(MavenPublication) {
|
|
||||||
from components.java
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -10,12 +10,6 @@ version '1.0'
|
|||||||
|
|
||||||
sourceCompatibility = 1.11
|
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 {
|
application {
|
||||||
mainClass.set("net.minestom.codegen.Generators")
|
mainClass.set("net.minestom.codegen.Generators")
|
||||||
}
|
}
|
||||||
@ -33,91 +27,18 @@ dependencies {
|
|||||||
implementation "org.jetbrains.kotlin:kotlin-reflect:${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 {
|
run {
|
||||||
// Update version
|
// Update version
|
||||||
setArgs(
|
setArgs(
|
||||||
List.of(
|
[
|
||||||
mcVersion,
|
// Point to gradle.properties "mcVersion"
|
||||||
dataDest.getAbsolutePath(),
|
project.rootProject.properties["mcVersion"],
|
||||||
project.rootProject.projectDir.getPath() + "${File.separatorChar}src${File.separatorChar}autogenerated${File.separatorChar}java")
|
// Points to src/main/resources/minecraft_data
|
||||||
|
project.rootProject.projectDir.getPath() + "${File.separatorChar}src${File.separatorChar}main${File.separatorChar}resources${File.separatorChar}minecraft_data",
|
||||||
|
// Points to src/autogenerated/java
|
||||||
|
project.rootProject.projectDir.getPath() + "${File.separatorChar}src${File.separatorChar}autogenerated${File.separatorChar}java"
|
||||||
|
]
|
||||||
)
|
)
|
||||||
dependsOn(downloadData)
|
dependsOn(project.rootProject.tasks.getByName("downloadResources"))
|
||||||
}
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
mcVersion = 1.16.5
|
||||||
asmVersion=9.0
|
asmVersion=9.0
|
||||||
mixinVersion=0.8.1
|
mixinVersion=0.8.1
|
||||||
hephaistosVersion=v1.1.8
|
hephaistosVersion=v1.1.8
|
||||||
|
@ -234,7 +234,7 @@ class BlockImpl implements Block {
|
|||||||
*/
|
*/
|
||||||
private static void loadBlockData() {
|
private static void loadBlockData() {
|
||||||
// E.G. 1_16_5_blocks.json
|
// E.G. 1_16_5_blocks.json
|
||||||
InputStream blocksIS = BlockImpl.class.getResourceAsStream("/minestom_data/" + MinecraftServer.VERSION_NAME_UNDERSCORED + "_blocks.json");
|
InputStream blocksIS = BlockImpl.class.getResourceAsStream("/minecraft_data/" + MinecraftServer.VERSION_NAME_UNDERSCORED + "_blocks.json");
|
||||||
if (blocksIS == null) {
|
if (blocksIS == null) {
|
||||||
LOGGER.error("Failed to find blocks.json");
|
LOGGER.error("Failed to find blocks.json");
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user