This repository has been archived by the owner on Mar 23, 2024. It is now read-only.
-
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
26 changed files
with
788 additions
and
2 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,5 @@ | ||
# Disable autocrlf on generated files, they always generate with LF | ||
# Add any extra files or paths here to make git stop saying they | ||
# are changed when only line endings change. | ||
src/generated/**/.cache/cache text eol=lf | ||
src/generated/**/*.json text eol=lf |
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,25 @@ | ||
# eclipse | ||
bin | ||
*.launch | ||
.settings | ||
.metadata | ||
.classpath | ||
.project | ||
|
||
# idea | ||
out | ||
*.ipr | ||
*.iws | ||
*.iml | ||
.idea | ||
|
||
# gradle | ||
build | ||
.gradle | ||
|
||
# other | ||
eclipse | ||
run | ||
|
||
# Files from Forge MDK | ||
forge*changelog.txt |
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,3 @@ | ||
[submodule "runenv"] | ||
path = runenv | ||
url = https://github.com/amadornes/fg-multiproject-runenv.git |
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 |
---|---|---|
@@ -1,2 +1,40 @@ | ||
# fg-multiproject-template | ||
Multiproject template for ForgeGradle development environments | ||
# ForgeGradle Multiproject Template | ||
|
||
This repository provides a template for multiproject development environments using ForgeGradle. | ||
|
||
It builds upon the [runenv template](https://github.com/amadornes/fg-multiproject-runenv) repo to provide the binding | ||
logic that makes the multiproject environment work. | ||
|
||
## Setup | ||
To set up a multiproject development environment, just clone this repository. | ||
Optionally, you may delete the `.git` directory and initialize your own git repo in its place. | ||
It is advised to keep the *runenv template* as a submodule, which allows you to easily pull new versions down the line. | ||
|
||
## Customization | ||
The most basic form of customization comes in the form of adding new projects to `settings.gradle`. | ||
Just add new `include 'YourProjectName'` lines in the same place you find the predefined ones. | ||
|
||
If you are authoring several mods that depend on each other, but you still want to be able to compile them on their own, | ||
this template also allows it. | ||
For example, if one of your projects depends on `fg.deobf("com.example:examplelib:1.2.3")`, you can define a | ||
substitution in the root level buildscript: `substitute module("com.example:examplelib") using project(":examplelib")`. | ||
This will make it so whatever depended on that artifact will now depend on the project in your dev environment instead. | ||
Make sure to also define an exclusion for the same module in the `if` statement above it. That will ensure that | ||
ForgeGradle doesn't try to unnecessarily resolve the artifact. | ||
|
||
Further customization can be done by either modifying the *runenv template*, or the `project('runenv')` closure in the | ||
root level buildscript. | ||
|
||
## Generating runs | ||
The run configurations for your multiproject environment belong to the *runenv template*. | ||
You must run that project's `setup<IDE>Runs` task and use its classpath at runtime. | ||
|
||
For datagen, you may still use each project's individual runs. | ||
|
||
## Known issues and currently untested features | ||
Please check the [runenv template](https://github.com/amadornes/fg-multiproject-runenv) repository, as that will contain | ||
the latest information regarding compatibility. Further updates will most likely be pushed there. | ||
|
||
## Contributions | ||
Pull requests adding extended feature support and bugfixes are welcome. | ||
Please keep them simple if possible. |
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,26 @@ | ||
subprojects { | ||
configurations.all { | ||
if (it.name.startsWith("_")) { | ||
exclude group: "com.example", module: "examplelib" | ||
return | ||
} | ||
|
||
resolutionStrategy.dependencySubstitution { | ||
substitute module("com.example:examplelib") using project(":examplelib") | ||
} | ||
} | ||
} | ||
|
||
project('runenv') { | ||
ext { | ||
mcversion = '1.17.1' | ||
forgeversion = '37.0.13' | ||
} | ||
repositories { | ||
} | ||
dependencies { | ||
// This is where any additional runtime dependencies for your dev environment go | ||
} | ||
} | ||
|
||
|
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,5 @@ | ||
# Disable autocrlf on generated files, they always generate with LF | ||
# Add any extra files or paths here to make git stop saying they | ||
# are changed when only line endings change. | ||
src/generated/**/.cache/cache text eol=lf | ||
src/generated/**/*.json text eol=lf |
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,25 @@ | ||
# eclipse | ||
bin | ||
*.launch | ||
.settings | ||
.metadata | ||
.classpath | ||
.project | ||
|
||
# idea | ||
out | ||
*.ipr | ||
*.iws | ||
*.iml | ||
.idea | ||
|
||
# gradle | ||
build | ||
.gradle | ||
|
||
# other | ||
eclipse | ||
run | ||
|
||
# Files from Forge MDK | ||
forge*changelog.txt |
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,105 @@ | ||
buildscript { | ||
repositories { | ||
maven { url = 'https://maven.minecraftforge.net' } | ||
mavenCentral() | ||
} | ||
dependencies { | ||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true | ||
} | ||
} | ||
apply plugin: 'net.minecraftforge.gradle' | ||
apply plugin: 'eclipse' | ||
apply plugin: 'maven-publish' | ||
|
||
version = _version | ||
group = 'com.example' | ||
archivesBaseName = 'ExampleLib' | ||
|
||
java.toolchain.languageVersion = JavaLanguageVersion.of(16) | ||
|
||
minecraft { | ||
mappings channel: 'official', version: _mcversion | ||
|
||
// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') | ||
|
||
runs { | ||
client { | ||
workingDirectory project.file('run/client') | ||
|
||
property 'forge.logging.markers', 'REGISTRIES' | ||
property 'forge.logging.console.level', 'debug' | ||
|
||
mods { | ||
examplelib { | ||
source sourceSets.main | ||
} | ||
} | ||
} | ||
|
||
server { | ||
workingDirectory project.file('run/server') | ||
|
||
property 'forge.logging.markers', 'REGISTRIES' | ||
property 'forge.logging.console.level', 'debug' | ||
|
||
mods { | ||
examplelib { | ||
source sourceSets.main | ||
} | ||
} | ||
} | ||
|
||
data { | ||
workingDirectory project.file('run/data') | ||
|
||
property 'forge.logging.markers', 'REGISTRIES' | ||
property 'forge.logging.console.level', 'debug' | ||
|
||
args '--mod', 'examplelib', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') | ||
|
||
mods { | ||
examplelib { | ||
source sourceSets.main | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
sourceSets.main.resources { srcDir 'src/generated/resources' } | ||
|
||
repositories { | ||
} | ||
|
||
dependencies { | ||
minecraft "net.minecraftforge:forge:${_mcversion}-${_forgeversion}" | ||
} | ||
|
||
jar { | ||
manifest { | ||
attributes([ | ||
"Specification-Title" : "examplelib", | ||
"Specification-Vendor" : "exampleauthor", | ||
"Specification-Version" : "1", | ||
"Implementation-Title" : project.name, | ||
"Implementation-Version" : project.jar.archiveVersion, | ||
"Implementation-Vendor" : "exampleauthor", | ||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") | ||
]) | ||
} | ||
} | ||
|
||
jar.finalizedBy('reobfJar') | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
artifact jar | ||
} | ||
} | ||
repositories { | ||
maven { | ||
url "file://${rootProject.projectDir}/mcmodsrepo" | ||
} | ||
} | ||
} |
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,3 @@ | ||
_version=0.0.1 | ||
_mcversion=1.17.1 | ||
_forgeversion=37.0.13 |
25 changes: 25 additions & 0 deletions
25
examplelib/src/main/java/com/example/examplelib/ExampleLib.java
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,25 @@ | ||
package com.example.examplelib; | ||
|
||
import net.minecraftforge.fml.common.Mod; | ||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; | ||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
@Mod("examplelib") | ||
public class ExampleLib | ||
{ | ||
private static final Logger LOGGER = LogManager.getLogger(); | ||
|
||
public ExampleLib() { | ||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); | ||
} | ||
|
||
private void setup(final FMLCommonSetupEvent event) { | ||
LOGGER.info("Hello from the library's preinit"); | ||
} | ||
|
||
public static void printTheThing() { | ||
LOGGER.info("I'm the library and I was asked to print the thing!"); | ||
} | ||
} |
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,25 @@ | ||
modLoader="javafml" | ||
loaderVersion="[37,)" | ||
license="MIT" | ||
|
||
[[mods]] | ||
modId="examplelib" | ||
version="${file.jarVersion}" | ||
displayName="Example Lib" | ||
authors="Example Author" | ||
description=''' | ||
This is an example library | ||
''' | ||
|
||
[[dependencies.examplelib]] | ||
modId="forge" | ||
mandatory=true | ||
versionRange="[37,)" | ||
ordering="NONE" | ||
side="BOTH" | ||
[[dependencies.examplelib]] | ||
modId="minecraft" | ||
mandatory=true | ||
versionRange="[1.17.1,1.18)" | ||
ordering="NONE" | ||
side="BOTH" |
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,7 @@ | ||
{ | ||
"pack": { | ||
"description": "examplelib resources", | ||
"pack_format": 6, | ||
"_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.2. Note: we require v6 pack meta for all mods." | ||
} | ||
} |
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,5 @@ | ||
# Disable autocrlf on generated files, they always generate with LF | ||
# Add any extra files or paths here to make git stop saying they | ||
# are changed when only line endings change. | ||
src/generated/**/.cache/cache text eol=lf | ||
src/generated/**/*.json text eol=lf |
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,25 @@ | ||
# eclipse | ||
bin | ||
*.launch | ||
.settings | ||
.metadata | ||
.classpath | ||
.project | ||
|
||
# idea | ||
out | ||
*.ipr | ||
*.iws | ||
*.iml | ||
.idea | ||
|
||
# gradle | ||
build | ||
.gradle | ||
|
||
# other | ||
eclipse | ||
run | ||
|
||
# Files from Forge MDK | ||
forge*changelog.txt |
Oops, something went wrong.