forked from GeyserMC/mappings-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
68 lines (53 loc) · 1.93 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import java.net.URL
import java.nio.channels.Channels
val javaMinecraftVersion = "1.18.1"
val bedrockResourcePackVersion = "1.18.0.27"
group = "org.geysermc.mappings-generator"
version = "1.1.0"
plugins {
java
`maven-publish`
id("org.spongepowered.gradle.vanilla")
}
dependencies {
implementation("org.projectlombok", "lombok", "1.18.20")
implementation("org.reflections", "reflections", "0.9.12")
implementation("com.nukkitx", "nbt", "2.0.2")
implementation("com.nukkitx.protocol", "bedrock-common", "2.9.4-SNAPSHOT")
annotationProcessor("org.projectlombok", "lombok", "1.18.20")
}
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_17
}
minecraft {
// https://github.com/SpongePowered/Sponge/blob/3cb480a347a33a424797c0e8f36b91cd1437d21d/build.gradle.kts
version(javaMinecraftVersion)
platform(org.spongepowered.gradle.vanilla.repository.MinecraftPlatform.CLIENT)
project.sourceSets["main"].resources
.filter { it.name.endsWith(".accesswidener") }
.files
.forEach {
accessWideners(it)
parent?.minecraft?.accessWideners(it)
}
}
val downloadResourcePack = tasks.register<DownloadFileTask>("downloadResourcePack") {
url = "https://void.bedrock.dev/resources/${bedrockResourcePackVersion}.zip"
fileLocation = "bedrockresourcepack.zip"
}
open class DownloadFileTask : DefaultTask() {
@Internal var url: String? = null
@Internal var fileLocation: String? = null
@TaskAction
fun greet() {
val file = File(fileLocation!!)
if (!file.exists()) {
println("Downloading file ${fileLocation}...")
val url = URL(url)
val channel = Channels.newChannel(url.openStream())
val outputStream = file.outputStream()
outputStream.channel.transferFrom(channel, 0, Long.MAX_VALUE)
println("Download of $fileLocation complete!")
}
}
}