Initial sanctuary sources
This commit is contained in:
@@ -0,0 +1,165 @@
|
||||
plugins {
|
||||
id "java"
|
||||
id "maven-publish"
|
||||
id "net.fabricmc.fabric-loom" version "${loom_version}"
|
||||
}
|
||||
|
||||
import groovy.json.JsonOutput
|
||||
import groovy.json.JsonSlurper
|
||||
|
||||
version = project.mod_version
|
||||
group = project.maven_group
|
||||
|
||||
base {
|
||||
archivesName = project.archives_base_name
|
||||
}
|
||||
|
||||
loom {
|
||||
splitEnvironmentSourceSets()
|
||||
|
||||
runs {
|
||||
client {
|
||||
programArgs "--username", "BlocodexDev", "--uuid", "000000000000400080000000000b10cd"
|
||||
}
|
||||
}
|
||||
|
||||
mods {
|
||||
blocodex {
|
||||
sourceSet sourceSets.main
|
||||
sourceSet sourceSets.client
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
implementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
|
||||
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:5.10.3"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.10.3"
|
||||
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand "version": inputs.properties.version
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.release = 25
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
sourceCompatibility = JavaVersion.VERSION_25
|
||||
targetCompatibility = JavaVersion.VERSION_25
|
||||
}
|
||||
|
||||
jar {
|
||||
from("license.txt")
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
tasks.register("importWsmcSnapshot") {
|
||||
group = "blocodex"
|
||||
description = "Import the local WSMC snapshot into a compact runtime asset."
|
||||
|
||||
def sourceFile = file("/Users/koka/Documents/wsmc/data/output/latest/snapshot.json")
|
||||
def outputFile = file("src/main/resources/assets/blocodex/data/wsmc_snapshot_compact.json")
|
||||
|
||||
inputs.file(sourceFile)
|
||||
outputs.file(outputFile)
|
||||
|
||||
doLast {
|
||||
if (!sourceFile.isFile()) {
|
||||
throw new GradleException("WSMC snapshot not found: ${sourceFile}")
|
||||
}
|
||||
|
||||
def snapshot = new JsonSlurper().parse(sourceFile)
|
||||
def entries = (snapshot.blocks ?: [])
|
||||
.findAll { it.visible == true && ["block", "item", "mob"].contains(it.entry_type) }
|
||||
.collect { entry ->
|
||||
[
|
||||
id : entry.id,
|
||||
name : entry.name,
|
||||
entry_type : entry.entry_type,
|
||||
description: entry.description ?: "",
|
||||
history : (entry.history ?: []).collect { note ->
|
||||
[
|
||||
version: note.version ?: "",
|
||||
status : note.status ?: "",
|
||||
notes : note.notes ?: ""
|
||||
]
|
||||
},
|
||||
colors : [
|
||||
primary : entry.colors?.primary ?: entry.colors?.average_hex ?: entry.colors?.dominant_hex ?: "#000000",
|
||||
dominant_hex : entry.colors?.dominant_hex ?: entry.colors?.primary ?: "#000000",
|
||||
average_hex : entry.colors?.average_hex ?: entry.colors?.primary ?: "#000000",
|
||||
hue_group : entry.colors?.hue_group ?: "neutral",
|
||||
lightness : entry.colors?.lightness ?: 0.0,
|
||||
saturation : entry.colors?.saturation ?: 0.0,
|
||||
palette : entry.colors?.palette ?: [],
|
||||
color_groups : (entry.colors?.color_groups ?: []).collect { group ->
|
||||
[
|
||||
hex : group.hex ?: "#000000",
|
||||
weight : group.weight ?: 0.0,
|
||||
lightness : group.lightness ?: 0.0,
|
||||
saturation: group.saturation ?: 0.0,
|
||||
hue_group : group.hue_group ?: "neutral"
|
||||
]
|
||||
},
|
||||
source : entry.colors?.source ?: ""
|
||||
],
|
||||
icon : entry.icon ?: "",
|
||||
family : entry.family ?: "",
|
||||
relations : (entry.relations ?: []).collect { relation ->
|
||||
[
|
||||
type : relation.type ?: "",
|
||||
target : relation.target ?: "",
|
||||
label : relation.label ?: "",
|
||||
confidence: relation.confidence ?: 0.0
|
||||
]
|
||||
},
|
||||
category : entry.category ?: ""
|
||||
]
|
||||
}
|
||||
.sort { a, b -> a.id <=> b.id }
|
||||
|
||||
def counts = entries.countBy { it.entry_type }
|
||||
def compact = [
|
||||
kind : "blocodex-wsmc-compact",
|
||||
schema_version : "0.1.0",
|
||||
minecraft_version: snapshot.minecraft_version ?: project.minecraft_version,
|
||||
source : sourceFile.absolutePath,
|
||||
source_fingerprint: snapshot.source_fingerprint ?: "",
|
||||
generated_at : snapshot.generated_at ?: "",
|
||||
entry_count : entries.size(),
|
||||
entry_type_counts: [
|
||||
block: counts.block ?: 0,
|
||||
item : counts.item ?: 0,
|
||||
mob : counts.mob ?: 0
|
||||
],
|
||||
entries : entries
|
||||
]
|
||||
|
||||
outputFile.parentFile.mkdirs()
|
||||
outputFile.text = JsonOutput.toJson(compact) + "\n"
|
||||
logger.lifecycle("Imported ${entries.size()} WSMC entries into ${outputFile}")
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create("mavenJava", MavenPublication) {
|
||||
artifactId = project.archives_base_name
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user