mirror of
https://github.com/architectury/architectury-templates.git
synced 2026-03-30 13:05:26 -05:00
Add forge-only template, fix compilation on packages
This commit is contained in:
@@ -1,24 +1,50 @@
|
||||
{
|
||||
"global_tokens": {
|
||||
"COMPILE_JAVA_8": "\n // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too\n // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.\n // We'll use that if it's available, but otherwise we'll use the older option.\n def targetVersion = 8\n if (JavaVersion.current().isJava9Compatible()) {\n options.release = targetVersion\n }",
|
||||
"COMPILE_JAVA_16": " options.release = 16",
|
||||
"COMPILE_JAVA_8": "\n // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too\n // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.\n // We'll use that if it's available, but otherwise we'll use the older option.\n def targetVersion = 8\n if (JavaVersion.current().isJava9Compatible()) {\n options.release = targetVersion\n }",
|
||||
"COMPILE_JAVA_16": " options.release = 16",
|
||||
"COMPILE_JAVA_8_ARCH": "\n // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too\n // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.\n // We'll use that if it's available, but otherwise we'll use the older option.\n def targetVersion = 8\n if (JavaVersion.current().isJava9Compatible()) {\n options.release = targetVersion\n }",
|
||||
"COMPILE_JAVA_16_ARCH": " options.release = 16",
|
||||
"FABRIC_LOADER": {
|
||||
"filter": ".*",
|
||||
"pom": "https://maven.fabricmc.net/net/fabricmc/fabric-loader/maven-metadata.xml"
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"1.16": {
|
||||
"1.16-forge": {
|
||||
"description": "1.16.5 Forge-Only Template",
|
||||
"templates": [
|
||||
"templates/simple",
|
||||
"templates/api_old"
|
||||
"templates/forge"
|
||||
],
|
||||
"tokens": {
|
||||
"MINECRAFT": "1.16.5",
|
||||
"COMPILE_JAVA": "#COMPILE_JAVA_8",
|
||||
"MCMETA_FORMAT": "6",
|
||||
"JEI_MAJOR": "7",
|
||||
"YARN_MAPPINGS": {
|
||||
"filter": "1\\.16\\.5\\+build\\..*",
|
||||
"pom": "https://maven.fabricmc.net/net/fabricmc/yarn/maven-metadata.xml"
|
||||
},
|
||||
"FORGE": {
|
||||
"filter": "1\\.16\\.5-.*",
|
||||
"pom": "https://maven.minecraftforge.net/net/minecraftforge/forge/maven-metadata.xml"
|
||||
},
|
||||
"FORGE_LOADER_MAJOR": "36"
|
||||
}
|
||||
},
|
||||
"1.16-architectury": {
|
||||
"description": "1.16.5 Multi-Loader Template",
|
||||
"templates": [
|
||||
"templates/architectury",
|
||||
"templates/api_old"
|
||||
],
|
||||
"tokens": {
|
||||
"MINECRAFT": "1.16.5",
|
||||
"COMPILE_JAVA": "#COMPILE_JAVA_8_ARCH",
|
||||
"FABRIC_LOADER": "#FABRIC_LOADER",
|
||||
"LOOM_FORGE_EXT": "",
|
||||
"MCMETA_FORMAT": "6",
|
||||
"ARCHITECTURY_GROUP": "me.shedaniel",
|
||||
"ARCHITECTURY_PACKAGE": "me.shedaniel.architectury",
|
||||
"ARCHITECTURY_API": {
|
||||
"filter": "1\\..*",
|
||||
"pom": "https://maven.architectury.dev/me/shedaniel/architectury/maven-metadata.xml"
|
||||
@@ -38,29 +64,54 @@
|
||||
"FORGE_LOADER_MAJOR": "36"
|
||||
}
|
||||
},
|
||||
"1.16-mixin": {
|
||||
"1.16-architectury-mixin": {
|
||||
"description": "1.16.5 Multi-Loader Template with Mixins",
|
||||
"templates": [
|
||||
"templates/simple",
|
||||
"templates/architectury",
|
||||
"templates/api_old",
|
||||
"templates/mixin"
|
||||
],
|
||||
"inherit_tokens": "1.16",
|
||||
"inherit_tokens": "1.16-architectury",
|
||||
"tokens": {
|
||||
"MIXIN_COMPAT_LEVEL": "JAVA_8",
|
||||
"LOOM_FORGE_EXT": "loom {\n forge {\n mixinConfig \"examplemod-common.mixins.json\"\n mixinConfig \"examplemod.mixins.json\"\n }\n}\n"
|
||||
}
|
||||
},
|
||||
"1.17": {
|
||||
"1.17-forge": {
|
||||
"description": "1.17.1 Forge-Only Template",
|
||||
"templates": [
|
||||
"templates/simple",
|
||||
"templates/api_new"
|
||||
"templates/forge"
|
||||
],
|
||||
"tokens": {
|
||||
"MINECRAFT": "1.17.1",
|
||||
"COMPILE_JAVA": "#COMPILE_JAVA_16",
|
||||
"MCMETA_FORMAT": "7",
|
||||
"JEI_MAJOR": "8",
|
||||
"YARN_MAPPINGS": {
|
||||
"filter": "1\\.17\\.1\\+build\\..*",
|
||||
"pom": "https://maven.fabricmc.net/net/fabricmc/yarn/maven-metadata.xml"
|
||||
},
|
||||
"FORGE": {
|
||||
"filter": "1\\.17\\.1-.*",
|
||||
"pom": "https://maven.minecraftforge.net/net/minecraftforge/forge/maven-metadata.xml"
|
||||
},
|
||||
"FORGE_LOADER_MAJOR": "37"
|
||||
}
|
||||
},
|
||||
"1.17-architectury": {
|
||||
"description": "1.17.1 Multi-Loader Template",
|
||||
"templates": [
|
||||
"templates/architectury",
|
||||
"templates/api_new"
|
||||
],
|
||||
"tokens": {
|
||||
"MINECRAFT": "1.17.1",
|
||||
"COMPILE_JAVA": "#COMPILE_JAVA_16_ARCH",
|
||||
"FABRIC_LOADER": "#FABRIC_LOADER",
|
||||
"LOOM_FORGE_EXT": "",
|
||||
"MCMETA_FORMAT": "7",
|
||||
"ARCHITECTURY_GROUP": "dev.architectury",
|
||||
"ARCHITECTURY_PACKAGE": "dev.architectury",
|
||||
"ARCHITECTURY_API": {
|
||||
"filter": "2\\..*",
|
||||
"pom": "https://maven.architectury.dev/dev/architectury/architectury/maven-metadata.xml"
|
||||
@@ -80,13 +131,14 @@
|
||||
"FORGE_LOADER_MAJOR": "37"
|
||||
}
|
||||
},
|
||||
"1.17-mixin": {
|
||||
"1.17-architectury-mixin": {
|
||||
"description": "1.17.1 Multi-Loader Template with Mixins",
|
||||
"templates": [
|
||||
"templates/simple",
|
||||
"templates/architectury",
|
||||
"templates/api_new",
|
||||
"templates/mixin"
|
||||
],
|
||||
"inherit_tokens": "1.17",
|
||||
"inherit_tokens": "1.17-architectury",
|
||||
"tokens": {
|
||||
"MIXIN_COMPAT_LEVEL": "JAVA_16",
|
||||
"LOOM_FORGE_EXT": "loom {\n forge {\n mixinConfig \"examplemod-common.mixins.json\"\n mixinConfig \"examplemod.mixins.json\"\n }\n}\n"
|
||||
|
||||
@@ -36,7 +36,10 @@ fun main() {
|
||||
val repository = github.getRepository(System.getenv("GITHUB_REPOSITORY"))
|
||||
githubRelease = repository.createRelease("release_" + System.getenv("GITHUB_JOB") + "_" + System.currentTimeMillis())
|
||||
.name("Architectury Templates")
|
||||
.body(Paths.get(System.getenv("BODY_PATH")).toFile().readText())
|
||||
.body(Paths.get(System.getenv("BODY_PATH")).toFile().readText() + "\n\n## Downloads\n" +
|
||||
config.versions.entries.joinToString("\n") { (id, entry) ->
|
||||
"- $id.zip: ${entry.description}"
|
||||
})
|
||||
.create()
|
||||
}
|
||||
config.versions.forEach { (id, entry) ->
|
||||
@@ -121,6 +124,7 @@ data class TemplateConfig(
|
||||
@Serializable
|
||||
data class TemplateEntry(
|
||||
val templates: List<String>,
|
||||
val description: String,
|
||||
val inherit_tokens: String? = null,
|
||||
val tokens: Map<String, JsonElement>,
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ dependencies {
|
||||
// Do NOT use other classes from fabric loader
|
||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||
// Remove the next line if you don't want to depend on the API
|
||||
modApi "dev.architectury:architectury:${rootProject.architectury_version}"
|
||||
modApi "@ARCHITECTURY_GROUP@:architectury:${rootProject.architectury_version}"
|
||||
}
|
||||
|
||||
architectury {
|
||||
@@ -19,7 +19,7 @@ dependencies {
|
||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
|
||||
// Remove the next line if you don't want to depend on the API
|
||||
modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}"
|
||||
modApi "@ARCHITECTURY_GROUP@:architectury-fabric:${rootProject.architectury_version}"
|
||||
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
||||
@@ -16,9 +16,9 @@ configurations {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}"
|
||||
forge "net.minecraftforge:forge:${rootProject.forge_version}"
|
||||
// Remove the next line if you don't want to depend on the API
|
||||
modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}"
|
||||
modApi "@ARCHITECTURY_GROUP@:architectury-forge:${rootProject.architectury_version}"
|
||||
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false }
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.examplemod.forge;
|
||||
|
||||
import dev.architectury.platform.forge.EventBuses;
|
||||
import @ARCHITECTURY_PACKAGE@.platform.forge.EventBuses;
|
||||
import net.examplemod.ExampleMod;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
33
templates/forge/.gitignore
vendored
Normal file
33
templates/forge/.gitignore
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
# gradle
|
||||
|
||||
.gradle/
|
||||
build/
|
||||
out/
|
||||
classes/
|
||||
|
||||
# eclipse
|
||||
|
||||
*.launch
|
||||
|
||||
# idea
|
||||
|
||||
.idea/
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
# vscode
|
||||
|
||||
.settings/
|
||||
.vscode/
|
||||
bin/
|
||||
.classpath
|
||||
.project
|
||||
|
||||
# macos
|
||||
|
||||
*.DS_Store
|
||||
|
||||
# fabric
|
||||
|
||||
run/
|
||||
169
templates/forge/build.gradle
Normal file
169
templates/forge/build.gradle
Normal file
@@ -0,0 +1,169 @@
|
||||
plugins {
|
||||
id 'dev.architectury.loom' version '0.10.0-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
// when using loom 0.10.0 with minecraft 1.16,
|
||||
// be sure to set this (and other references to Java 16)
|
||||
// to Java 8, obviously
|
||||
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_16
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
version = project.mod_version
|
||||
group = project.maven_group
|
||||
|
||||
loom {
|
||||
// use this if you are using the official mojang mappings
|
||||
// and want loom to stop warning you about their license
|
||||
silentMojangMappingsLicense()
|
||||
|
||||
// since loom 0.10, you are **required** to use the
|
||||
// "forge" block to configure forge-specific features,
|
||||
// such as the mixinConfigs array or datagen
|
||||
forge {
|
||||
// specify the mixin configs used in this mod
|
||||
// this will be added to the jar manifest as well!
|
||||
mixinConfigs = [
|
||||
"examplemod.mixins.json"
|
||||
]
|
||||
|
||||
// missing access transformers?
|
||||
// don't worry, you can still use them!
|
||||
// note that your AT *MUST* be located at
|
||||
// src/main/resources/META-INF/accesstransformer.cfg
|
||||
// to work as there is currently no config option to change this.
|
||||
// also, any names used in your access transformer will need to be
|
||||
// in SRG mapped ("func_" / "field_" with MCP class names) to work!
|
||||
// (both of these things may be subject to change in the future)
|
||||
|
||||
// this will create a data generator configuration
|
||||
// that you can use to automatically generate assets and data
|
||||
// using architectury loom. Note that this currently *only* works
|
||||
// for forge projects made with architectury loom!
|
||||
dataGen {
|
||||
mod project.mod_id
|
||||
}
|
||||
}
|
||||
|
||||
// This allows you to modify your launch configurations,
|
||||
// for example to add custom arguments. In this case, we want
|
||||
// the data generator to check our resources directory for
|
||||
// existing files. (see Forge's ExistingFileHelper for more info)
|
||||
launches {
|
||||
data {
|
||||
arg "--existing", file("src/main/resources").absolutePath
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
// Add repositories to retrieve artifacts from in here.
|
||||
// You should only use this when depending on other mods because
|
||||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
||||
// for more information about repositories.
|
||||
|
||||
// in this example, we need the following maven
|
||||
// to satisfy our dependency for JEI.
|
||||
maven {
|
||||
name = "Progwml6 (Just Enough Items)"
|
||||
url = "https://dvs1.progwml6.com/files/maven/"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// to change the versions see the gradle.properties file
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
|
||||
// choose what mappings you want to use here
|
||||
// leave this uncommented if you want to use
|
||||
// mojang's official mappings, or feel free
|
||||
// to add your own mappings here (how about
|
||||
// mojmap layered with parchment, for example?)
|
||||
mappings minecraft.officialMojangMappings()
|
||||
|
||||
// uncomment this if you want to use yarn mappings
|
||||
// mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||
|
||||
// your forge dependency, this is **required** when using Forge Loom in forge mode!
|
||||
forge "net.minecraftforge:forge:${project.forge_version}"
|
||||
|
||||
// additional dependencies can be specified using loom's regular format
|
||||
// specifying a "mod" dependency (like modImplementation or modApi)
|
||||
// will cause loom to remap the file to your specified mappings
|
||||
|
||||
// in this example, we'll be adding JEI as a dependency
|
||||
// according to their developer example on GitHub
|
||||
// see: https://github.com/mezz/JustEnoughItems/wiki/Getting-Started
|
||||
// compile against the JEI API but do not include it at runtime
|
||||
// don't worry about loom "not finding a forge mod" here,
|
||||
// JEI's api just doesn't have any class with an @Mod annotation
|
||||
modCompileOnly "mezz.jei:jei-@MINECRAFT@:${jei_version}:api"
|
||||
// at runtime, use the full JEI jar
|
||||
modRuntimeOnly "mezz.jei:jei-@MINECRAFT@:${jei_version}"
|
||||
}
|
||||
|
||||
processResources {
|
||||
// define properties that can be used during resource processing
|
||||
inputs.property "version", project.version
|
||||
|
||||
// this will replace the property "${version}" in your mods.toml
|
||||
// with the version you've defined in your gradle.properties
|
||||
filesMatching("META-INF/mods.toml") {
|
||||
expand "version": project.version
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||
// this fixes some edge cases with special characters not displaying correctly
|
||||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||
// If Javadoc is generated, this must be specified in that task too.
|
||||
options.encoding = "UTF-8"
|
||||
@COMPILE_JAVA@
|
||||
}
|
||||
|
||||
java {
|
||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||
// if it is present.
|
||||
// If you remove this line, sources will not be generated.
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
jar {
|
||||
// add some additional metadata to the jar manifest
|
||||
manifest {
|
||||
attributes([
|
||||
"Specification-Title" : project.mod_id,
|
||||
"Specification-Vendor" : project.mod_author,
|
||||
"Specification-Version" : "1",
|
||||
"Implementation-Title" : project.name,
|
||||
"Implementation-Version" : version,
|
||||
"Implementation-Vendor" : project.mod_author,
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
// configure the maven publication
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
// add all the jars that should be included when publishing to maven
|
||||
artifact(remapJar) {
|
||||
builtBy remapJar
|
||||
}
|
||||
artifact(sourcesJar) {
|
||||
builtBy remapSourcesJar
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
||||
repositories {
|
||||
// Add repositories to publish to here.
|
||||
// Notice: This block does NOT have the same function as the block in the top level.
|
||||
// The repositories here will be used for publishing your artifact, not for
|
||||
// retrieving dependencies.
|
||||
}
|
||||
}
|
||||
26
templates/forge/gradle.properties
Normal file
26
templates/forge/gradle.properties
Normal file
@@ -0,0 +1,26 @@
|
||||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
# tell architectury loom that this project is a forge project.
|
||||
# this will enable us to use the "forge" dependency.
|
||||
# using archloom without this is possible and will give you a
|
||||
# "standard" loom installation with some extra features.
|
||||
loom.platform=forge
|
||||
|
||||
# Base properties
|
||||
# minecraft version
|
||||
minecraft_version=@MINECRAFT@
|
||||
# forge version, latest version can be found on https://files.minecraftforge.net/
|
||||
forge_version=@FORGE@
|
||||
# yarn, latest version can be found on https://fabricmc.net/use
|
||||
yarn_mappings=@YARN_MAPPINGS@
|
||||
|
||||
# Mod Properties
|
||||
mod_version=1.0.0
|
||||
maven_group=com.example.examplemod
|
||||
archives_base_name=archloom-example-mod
|
||||
mod_id=archloom-example-mod
|
||||
mod_author=TheExampleDev
|
||||
|
||||
# Dependencies
|
||||
jei_version=@JEI_MAJOR@.+
|
||||
BIN
templates/forge/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
templates/forge/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
templates/forge/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
templates/forge/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
185
templates/forge/gradlew
vendored
Executable file
185
templates/forge/gradlew
vendored
Executable file
@@ -0,0 +1,185 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MSYS* | MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
89
templates/forge/gradlew.bat
vendored
Normal file
89
templates/forge/gradlew.bat
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
10
templates/forge/settings.gradle
Normal file
10
templates/forge/settings.gradle
Normal file
@@ -0,0 +1,10 @@
|
||||
pluginManagement {
|
||||
// when using additional gradle plugins like shadow,
|
||||
// add their repositories to this list!
|
||||
repositories {
|
||||
maven { url "https://maven.fabricmc.net/" }
|
||||
maven { url "https://maven.architectury.dev/" }
|
||||
maven { url "https://files.minecraftforge.net/maven/" }
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.example.examplemod;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.ExplosionEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
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("examplemod")
|
||||
public class ExampleMod {
|
||||
|
||||
public static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
public ExampleMod() {
|
||||
|
||||
// This is our mod's event bus, used for things like registry or lifecycle events
|
||||
IEventBus MOD_BUS = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
|
||||
// This listener is fired on both client and server during setup.
|
||||
MOD_BUS.addListener(this::commonSetup);
|
||||
// This listener is only fired during client setup, so we can use client-side methods here.
|
||||
MOD_BUS.addListener(this::clientSetup);
|
||||
|
||||
// Most other events are fired on Forge's bus.
|
||||
// If we want to use annotations to register event listeners,
|
||||
// we need to register our object like this!
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
// For more information on how to deal with events in Forge,
|
||||
// like automatically subscribing an entire class to an event bus
|
||||
// or using static methods to listen to events,
|
||||
// feel free to check out the Forge wiki!
|
||||
}
|
||||
|
||||
private void commonSetup(final FMLCommonSetupEvent event) {
|
||||
LOGGER.info("Hello from common setup! This is *after* registries are done, so we can do this:");
|
||||
LOGGER.info("Look, I found a {}!", Items.DIAMOND.getRegistryName());
|
||||
}
|
||||
|
||||
private void clientSetup(final FMLClientSetupEvent event) {
|
||||
LOGGER.info("Hey, we're on Minecraft version {}!", Minecraft.getInstance().getLaunchedVersion());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void kaboom(ExplosionEvent.Detonate event) {
|
||||
LOGGER.info("Kaboom! Something just blew up in {}!", event.getWorld());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.example.examplemod.mixin;
|
||||
|
||||
import com.example.examplemod.ExampleMod;
|
||||
import net.minecraft.client.gui.screens.TitleScreen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(TitleScreen.class)
|
||||
public class ExampleMixin {
|
||||
@Inject(at = @At("HEAD"), method = "init()V")
|
||||
private void init(CallbackInfo info) {
|
||||
ExampleMod.LOGGER.info("This line is printed by an example mod mixin!");
|
||||
}
|
||||
}
|
||||
58
templates/forge/src/main/resources/META-INF/mods.toml
Normal file
58
templates/forge/src/main/resources/META-INF/mods.toml
Normal file
@@ -0,0 +1,58 @@
|
||||
# This is an example mods.toml file.
|
||||
# Any fields that aren't annotated with #optional are *required*!
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[@FORGE_LOADER_MAJOR@,)"
|
||||
license = "All rights reserved" # Want to make your mod open source? Check out https://choosealicense.com/!
|
||||
|
||||
# This is a URL to e.g. your GitHub or CurseForge issues page.
|
||||
# It will appear in any crash reports this mod is directly involved in.
|
||||
# issueTrackerURL="https://github.com/invalid/pleasechangeme/issues" #optional
|
||||
# A list of mods - how many allowed here is determined by the individual mod loader
|
||||
|
||||
[[mods]]
|
||||
modId = "examplemod"
|
||||
# The version number of the mod - unlike in the Forge MDK,
|
||||
# we'll use the processResources task to replace this for us
|
||||
version = "${version}"
|
||||
displayName = "Example Mod"
|
||||
# This URL will be queried by the Forge update checker in order to find the latest version of your mod.
|
||||
# If an update is found, you'll see a little blinking "emerald" symbol on your Mods button!
|
||||
# updateJSONURL="https://changeme.dev/updates.json" #optional
|
||||
# This is your mod's "homepage" and will be displayed on the mod's information screen in the Mods panel.
|
||||
# displayURL="https://changeme.dev/" #optional
|
||||
# This will be displayed as your mod's logo in the Mods panel.
|
||||
# logoFile="icon.png" #optional
|
||||
# Some more fluff displayed in the Mods panel. Feel free to issue your special thanks here!
|
||||
# credits="Thanks to Mojang for making this great game" #optional
|
||||
# Some more fluff displayed in the Mods panel. Plug your stuff here!
|
||||
# authors="Me!" #optional
|
||||
# A multi-line description for your mod. This has no minimum length, but it *is* required!
|
||||
description = '''
|
||||
This is a very cool mod that does... things.
|
||||
|
||||
...and stuff.
|
||||
|
||||
Have I reached 280 characters yet?
|
||||
'''
|
||||
|
||||
# An (optional) dependency for your mod. Though technically not required,
|
||||
# it's always helpful to add these to stop your mod from loading when something is missing
|
||||
# rather than erroring out later
|
||||
[[dependencies.examplemod]]
|
||||
modId = "forge"
|
||||
mandatory = true # do you **need** this mod to be able to launch?
|
||||
# A version range using interval notation.
|
||||
# Brackets mean "inclusive" bounds, while parentheses mean "exclusive".
|
||||
versionRange = "[@FORGE_LOADER_MAJOR@,)" # This essentially means any forge >= @FORGE_LOADER_MAJOR@
|
||||
ordering = "NONE" # Use this if you want your mod to be loaded specifically BEFORE or AFTER another mod
|
||||
side = "BOTH" # Specify where this mod is required: can be BOTH, CLIENT or SERVER
|
||||
|
||||
# And another dependency, use this if you want to require a certain Minecraft version.
|
||||
[[dependencies.examplemod]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
# See above for how to read this notation, this essentially means any
|
||||
# version of Minecraft from @MINECRAFT@ (inclusive).
|
||||
versionRange = "[@MINECRAFT@,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
13
templates/forge/src/main/resources/examplemod.mixins.json
Normal file
13
templates/forge/src/main/resources/examplemod.mixins.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "com.example.examplemod.mixin",
|
||||
"compatibilityLevel": "@MIXIN_COMPAT_LEVEL@",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"ExampleMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
7
templates/forge/src/main/resources/pack.mcmeta
Normal file
7
templates/forge/src/main/resources/pack.mcmeta
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "Resources for examplemod",
|
||||
"pack_format": @MCMETA_FORMAT@,
|
||||
"_comment": "pack_format @MCMETA_FORMAT@ is the current format for Minecraft @MINECRAFT@. Be aware may have changed by the time you use this template!"
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "net.examplemod.mixin",
|
||||
"compatibilityLevel": "@MIXIN_COMPAT_LEVEL@",
|
||||
"client": [
|
||||
],
|
||||
"mixins": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
"required": true,
|
||||
"package": "net.examplemod.mixin",
|
||||
"compatibilityLevel": "@MIXIN_COMPAT_LEVEL@",
|
||||
"client": [
|
||||
],
|
||||
"mixins": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
|
||||
{
|
||||
"required": true,
|
||||
"package": "net.examplemod.mixin.fabric",
|
||||
"compatibilityLevel": "@MIXIN_COMPAT_LEVEL@",
|
||||
"client": [
|
||||
],
|
||||
"mixins": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
"required": true,
|
||||
"package": "net.examplemod.mixin.fabric",
|
||||
"compatibilityLevel": "@MIXIN_COMPAT_LEVEL@",
|
||||
"client": [
|
||||
],
|
||||
"mixins": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
|
||||
{
|
||||
"required": true,
|
||||
"package": "net.examplemod.mixin.fabric",
|
||||
"compatibilityLevel": "@MIXIN_COMPAT_LEVEL@",
|
||||
"client": [
|
||||
],
|
||||
"mixins": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
"required": true,
|
||||
"package": "net.examplemod.mixin.forge",
|
||||
"compatibilityLevel": "@MIXIN_COMPAT_LEVEL@",
|
||||
"client": [
|
||||
],
|
||||
"mixins": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user