-
Notifications
You must be signed in to change notification settings - Fork 137
/
build.gradle
145 lines (123 loc) · 3.63 KB
/
build.gradle
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
buildscript {
repositories {
mavenLocal()
maven { url = 'https://maven.minecraftforge.net' }
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:6+'
classpath "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:1.1.3"
}
}
import net.minecraftforge.gradle.common.util.Utils
import net.minecraftforge.gradle.common.util.VersionJson
import org.jetbrains.gradle.ext.*
apply plugin: 'eclipse'
apply plugin: 'net.minecraftforge.gradle.patcher'
apply plugin: "org.jetbrains.gradle.plugin.idea-ext"
println(' Java: ' + System.getProperty('java.version') +
' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ')' +
' Arch: ' + System.getProperty('os.arch'))
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
configurations {
shade
compile.extendsFrom shade
}
group = 'me.yourname'
version = '1.0.0'
ext {
minecraft_version = '1.20.2'
mcp_version = '20230921.100330'
mappings_channel = 'official'
mappings_version = '1.20.2'
spi_version = '7.0.0'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'net.minecraftforge:forgespi:' + spi_version
// Use the shade to add the lib to the jar
// or use compile if you want to load the lib from the version.json
// from a maven repo
// shade 'package-here'
// compile 'package-here'
}
project(':mcp') {
apply plugin: 'net.minecraftforge.gradle.mcp'
mcp {
config = minecraft_version + '-' + mcp_version
pipeline = 'joined'
}
}
evaluationDependsOn(':mcp')
patcher {
parent = project(':mcp')
patchedSrc = file('src/main/java')
mappings channel: mappings_channel, version: mappings_version
mcVersion = minecraft_version
}
jar {
configurations.shade.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
}
var assetsFolder = file('run/assets')
tasks.register('runclient', JavaExec) {
group = "MCP"
description = "Runs the client"
classpath sourceSets.main.runtimeClasspath
if (System.getProperty("os.name").toLowerCase().contains("mac")) {
jvmArgs '-XstartOnFirstThread'
}
var runFolder = file('run')
var versionJson = Utils.loadJson(downloadAssets.getMeta().get().getAsFile(), VersionJson.class)
workingDir runFolder
args '--gameDir', '.'
args '--version', minecraft_version
args '--assetsDir', runFolder.relativePath(assetsFolder)
args '--assetIndex', versionJson.assetIndex.id
args '--accessToken', '0'
main 'net.minecraft.client.main.Main'
}
tasks.register('setup') {
group = "MCP"
description = "Setups the dev workspace"
dependsOn ':extractMapped'
mkdir assetsFolder
copy {
from downloadAssets.output.path
into assetsFolder
}
}
tasks.register('copyAssets') {
group = "MCP"
description = "Download and place the assets into the run folder"
dependsOn ':downloadAssets'
mkdir 'run/assets'
copy {
from downloadAssets.output.path
into assetsFolder
}
}
tasks.register('runserver', JavaExec) {
mkdir 'runserver'
group = "MCP"
description = "Runs the server"
standardInput = System.in
classpath sourceSets.main.runtimeClasspath
main 'net.minecraft.server.Main'
workingDir 'runserver'
}
idea.project.settings {
runConfigurations {
"Minecraft"(Application) {
mainClass = 'mcp.client.Start'
workingDirectory = "$projectDir/run"
moduleName = idea.module.name + '.main'
}
}
}