diff options
Diffstat (limited to 'plugin/src/main/kotlin/moe/nea/archenemy/mojang/OfficialMappingDependency.kt')
-rw-r--r-- | plugin/src/main/kotlin/moe/nea/archenemy/mojang/OfficialMappingDependency.kt | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/plugin/src/main/kotlin/moe/nea/archenemy/mojang/OfficialMappingDependency.kt b/plugin/src/main/kotlin/moe/nea/archenemy/mojang/OfficialMappingDependency.kt new file mode 100644 index 0000000..8617ede --- /dev/null +++ b/plugin/src/main/kotlin/moe/nea/archenemy/mojang/OfficialMappingDependency.kt @@ -0,0 +1,42 @@ +package moe.nea.archenemy.mojang + +import moe.nea.archenemy.MCSide +import org.gradle.api.artifacts.Dependency +import org.gradle.api.provider.Provider +import java.io.File +import java.security.MessageDigest + +class OfficialMappingDependency( + val side: MCSide, + val version: String, + val dependency: Provider<Dependency> +) : MappingDependency, + Provider<Dependency> by dependency { + + override fun updateHash(digest: MessageDigest) { + digest.update("official") + digest.updateField("side", side.toString()) + digest.updateField("version", version) + } + + override fun title(): String { + return "official-$side-${version.replace(".","_")}" + } + + override fun findMapping(files: Set<File>): File? { + return files.singleOrNull { + it.name == "minecraft-${version}-${side}-mappings.txt" + } + } + + override fun applyMapping( + mappingsFile: File, + sourceFile: File, + targetFile: File, + sourceNameSpace: String, + targetNameSpace: String + ) { + sourceFile.copyTo(targetFile) + } + +}
\ No newline at end of file |