-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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.3' | ||
mcp_version = '' | ||
mappings_channel = 'official' | ||
mappings_version = '1.20.3' | ||
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' | ||
} | ||
} | ||
} |