generated from CleanroomMC/TemplateDevEnv
-
Notifications
You must be signed in to change notification settings - Fork 2
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
0 parents
commit 309d1d1
Showing
13 changed files
with
682 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,22 @@ | ||
# eclipse | ||
bin | ||
*.launch | ||
.settings | ||
.metadata | ||
.classpath | ||
.project | ||
|
||
# idea | ||
out | ||
*.ipr | ||
*.iws | ||
*.iml | ||
.idea | ||
|
||
# gradle | ||
build | ||
.gradle | ||
|
||
# other | ||
eclipse | ||
run |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 CleanroomMC | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,16 @@ | ||
## TemplateDevEnv | ||
|
||
Template workspace for modding Minecraft 1.12.2. Licensed under MIT, it is made for public use. | ||
|
||
This template currently utilizies **Gradle 8.1.1** + **[RetroFuturaGradle](https://github.com/GTNewHorizons/RetroFuturaGradle) 1.3.6** + **Forge 14.23.5.2847**. | ||
|
||
With **coremod and mixin support** that is easy to configure. | ||
|
||
### Instructions: | ||
|
||
1. Click `use this template` at the top. | ||
2. Clone the repository you have created with this template. | ||
3. In the local repository, run the command `gradlew setupDecompWorkspace` | ||
4. Open the project folder in IDEA. | ||
5. Right-click in IDEA `build.gradle` of your project, and select `Link Gradle Project`, after completion, hit `Refresh All` in the gradle tab on the right. | ||
6. Run `gradlew runClient` and `gradlew runServer`, or use the auto-imported run configurations in IntelliJ like `1. Run Client`. |
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,207 @@ | ||
import org.jetbrains.gradle.ext.Gradle | ||
|
||
plugins { | ||
id 'java' | ||
id 'java-library' | ||
id 'maven-publish' | ||
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.7' | ||
id 'eclipse' | ||
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.16' | ||
id 'com.matthewprenger.cursegradle' version '1.4.0' | ||
} | ||
|
||
version = project.mod_version | ||
group = project.maven_group | ||
archivesBaseName = project.archives_base_name | ||
|
||
// Set the toolchain version to decouple the Java we run Gradle with from the Java used to compile and run the mod | ||
java { | ||
toolchain { | ||
languageVersion.set(JavaLanguageVersion.of(8)) | ||
// Azul covers the most platforms for Java 8 toolchains, crucially including MacOS arm64 | ||
vendor.set(org.gradle.jvm.toolchain.JvmVendorSpec.AZUL) | ||
} | ||
// Generate sources and javadocs jars when building and publishing | ||
withSourcesJar() | ||
// withJavadocJar() | ||
} | ||
|
||
tasks.withType(JavaCompile).configureEach { | ||
options.encoding = 'UTF-8' | ||
} | ||
|
||
configurations { | ||
embed | ||
implementation.extendsFrom(embed) | ||
} | ||
|
||
minecraft { | ||
mcVersion = '1.12.2' | ||
|
||
// MCP Mappings | ||
mcpMappingChannel = 'stable' | ||
mcpMappingVersion = '39' | ||
|
||
// Set username here, the UUID will be looked up automatically | ||
username = 'Developer' | ||
|
||
// Add any additional tweaker classes here | ||
// extraTweakClasses.add('org.spongepowered.asm.launch.MixinTweaker') | ||
|
||
// Add various JVM arguments here for runtime | ||
def args = ["-ea:${project.group}"] | ||
if (project.use_coremod.toBoolean()) { | ||
args << '-Dfml.coreMods.load=' + coremod_plugin_class_name | ||
} | ||
if (project.use_mixins.toBoolean()) { | ||
args << '-Dmixin.hotSwap=true' | ||
args << '-Dmixin.checks.interfaces=true' | ||
args << '-Dmixin.debug.export=true' | ||
} | ||
extraRunJvmArguments.addAll(args) | ||
|
||
// Include and use dependencies' Access Transformer files | ||
useDependencyAccessTransformers = true | ||
|
||
// Add any properties you want to swap out for a dynamic value at build time here | ||
// Any properties here will be added to a class at build time, the name can be configured below | ||
// Example: | ||
// injectedTags.put('VERSION', project.version) | ||
// injectedTags.put('MOD_ID', project.archives_base_name) | ||
} | ||
|
||
// Generate a group.archives_base_name.Tags class | ||
tasks.injectTags.configure { | ||
// Change Tags class' name here: | ||
outputClassName.set("${project.group}.${project.archives_base_name}.Tags") | ||
} | ||
|
||
repositories { | ||
maven { | ||
name 'CleanroomMC Maven' | ||
url 'https://maven.cleanroommc.com' | ||
} | ||
maven { | ||
name 'SpongePowered Maven' | ||
url 'https://repo.spongepowered.org/maven' | ||
} | ||
maven { | ||
name 'CurseMaven' | ||
url 'https://cursemaven.com' | ||
content { | ||
includeGroup 'curse.maven' | ||
} | ||
} | ||
mavenLocal() // Must be last for caching to work | ||
} | ||
|
||
dependencies { | ||
if (project.use_assetmover.toBoolean()) { | ||
implementation 'com.cleanroommc:assetmover:2.5' | ||
} | ||
if (project.use_mixins.toBoolean()) { | ||
implementation 'zone.rong:mixinbooter:7.1' | ||
} | ||
|
||
// Example of deobfuscating a dependency | ||
// implementation rfg.deobf('curse.maven:had-enough-items-557549:4543375') | ||
|
||
if (project.use_mixins.toBoolean()) { | ||
// Change your mixin refmap name here: | ||
String mixin = modUtils.enableMixins('org.spongepowered:mixin:0.8.3', "mixins.${project.archives_base_name}.refmap.json") | ||
api (mixin) { | ||
transitive = false | ||
} | ||
annotationProcessor 'org.ow2.asm:asm-debug-all:5.2' | ||
annotationProcessor 'com.google.guava:guava:24.1.1-jre' | ||
annotationProcessor 'com.google.code.gson:gson:2.8.6' | ||
annotationProcessor (mixin) { | ||
transitive = false | ||
} | ||
} | ||
|
||
} | ||
|
||
// Adds Access Transformer files to tasks | ||
if (project.use_access_transformer.toBoolean()) { | ||
for (File at : sourceSets.getByName("main").resources.files) { | ||
if (at.name.toLowerCase().endsWith("_at.cfg")) { | ||
tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(at) | ||
tasks.srgifyBinpatchedJar.accessTransformerFiles.from(at) | ||
} | ||
} | ||
} | ||
|
||
processResources { | ||
// This will ensure that this task is redone when the versions change | ||
inputs.property 'version', project.version | ||
inputs.property 'mcversion', project.minecraft.version | ||
|
||
// Replace various properties in mcmod.info and pack.mcmeta if applicable | ||
filesMatching(['mcmod.info', 'pack.mcmeta']) { fcd -> | ||
// Replace version and mcversion | ||
fcd.expand ( | ||
'version': project.version, | ||
'mcversion': project.minecraft.version | ||
) | ||
} | ||
|
||
if (project.use_access_transformer.toBoolean()) { | ||
rename '(.+_at.cfg)', 'META-INF/$1' // Make sure Access Transformer files are in META-INF folder | ||
} | ||
} | ||
|
||
jar { | ||
manifest { | ||
def attribute_map = [:] | ||
if (project.use_coremod.toBoolean()) { | ||
attribute_map['FMLCorePlugin'] = project.coremod_plugin_class_name | ||
if (project.include_mod.toBoolean()) { | ||
attribute_map['FMLCorePluginContainsFMLMod'] = true | ||
attribute_map['ForceLoadAsMod'] = project.gradle.startParameter.taskNames[0] == "build" | ||
} | ||
} | ||
if (project.use_access_transformer.toBoolean()) { | ||
attribute_map['FMLAT'] = project.archives_base_name + '_at.cfg' | ||
} | ||
attributes(attribute_map) | ||
} | ||
// Add all embedded dependencies into the jar | ||
from(provider{ configurations.embed.collect {it.isDirectory() ? it : zipTree(it)} }) | ||
} | ||
|
||
idea { | ||
module { | ||
inheritOutputDirs = true | ||
} | ||
project { | ||
settings { | ||
runConfigurations { | ||
"1. Run Client"(Gradle) { | ||
taskNames = ["runClient"] | ||
} | ||
"2. Run Server"(Gradle) { | ||
taskNames = ["runServer"] | ||
} | ||
"3. Run Obfuscated Client"(Gradle) { | ||
taskNames = ["runObfClient"] | ||
} | ||
"4. Run Obfuscated Server"(Gradle) { | ||
taskNames = ["runObfServer"] | ||
} | ||
} | ||
compiler.javac { | ||
afterEvaluate { | ||
javacAdditionalOptions = "-encoding utf8" | ||
moduleJavacAdditionalOptions = [ | ||
(project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ') | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
tasks.named("processIdeaSettings").configure { | ||
dependsOn("injectTags") | ||
} |
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,22 @@ | ||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties. | ||
# This is required to provide enough memory for the Minecraft decompilation process. | ||
org.gradle.jvmargs = -Xmx3G | ||
|
||
# Mod Information | ||
mod_version = 1.0 | ||
maven_group = com.cleanroommc | ||
archives_base_name = modid | ||
|
||
# If any properties changes below this line, run `gradlew setupDecompWorkspace` and refresh gradle again to ensure everything is working correctly. | ||
|
||
# Boilerplate Options | ||
use_mixins = false | ||
use_coremod = false | ||
use_assetmover = false | ||
|
||
# Access Transformer files should be in the root of `resources` folder and with the filename formatted as: `{archives_base_name}_at.cfg` | ||
use_access_transformer = false | ||
|
||
# Coremod Arguments | ||
include_mod = true | ||
coremod_plugin_class_name = |
Binary file not shown.
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,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.