mirror of
https://github.com/ViaVersion/ViaForge.git
synced 2024-11-21 11:55:13 +01:00
🛠 Forgegradle 5 & Gradle 7 Upgrade
- Use the latest forgegradle available, forgegradle 5 - Update mixins - Remove the terrible libs folder and grab libs from repos - Rewrite build.gradle, settings.gradle, gradle.properties to support forgegradle 5 - Upgraded to gradle 7.2 - Use DefaultEventLoopGroup instead of LocalEventLoopGroup, as the latter is deprecated - Both dev environment and building have been tested
This commit is contained in:
parent
2e77f253e5
commit
b1c239fdbb
42
.gitignore
vendored
42
.gitignore
vendored
@ -1,29 +1,25 @@
|
||||
# gradle
|
||||
|
||||
.gradle/
|
||||
build/
|
||||
out/
|
||||
classes/
|
||||
|
||||
# eclipse
|
||||
|
||||
bin
|
||||
*.launch
|
||||
|
||||
# idea
|
||||
|
||||
.idea/
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
# vscode
|
||||
|
||||
.settings/
|
||||
.vscode/
|
||||
bin/
|
||||
.settings
|
||||
.metadata
|
||||
.classpath
|
||||
.project
|
||||
|
||||
# fabric
|
||||
# idea
|
||||
out
|
||||
*.ipr
|
||||
*.iws
|
||||
*.iml
|
||||
.idea
|
||||
|
||||
run/
|
||||
# gradle
|
||||
build
|
||||
.gradle
|
||||
|
||||
# other
|
||||
eclipse
|
||||
run
|
||||
|
||||
# Files from Forge MDK
|
||||
forge*changelog.txt
|
||||
|
242
build.gradle
242
build.gradle
@ -1,133 +1,179 @@
|
||||
buildscript {
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
|
||||
maven { url 'https://files.minecraftforge.net/maven' }
|
||||
maven { url 'https://plugins.gradle.org/m2' }
|
||||
maven { url 'https://repo.spongepowered.org/repository/maven-public' }
|
||||
plugins {
|
||||
id "java"
|
||||
id "idea"
|
||||
id "maven-publish"
|
||||
id "net.minecraftforge.gradle" version "5.1.+"
|
||||
id "org.spongepowered.mixin" version "0.7-SNAPSHOT"
|
||||
id "com.github.johnrengelman.shadow" version "7.0.0"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '2.3-SNAPSHOT'
|
||||
classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.6-SNAPSHOT'
|
||||
classpath group: 'com.github.jengelman.gradle.plugins', name: 'shadow', version: '4.0.4'
|
||||
}
|
||||
}
|
||||
version = "${minecraft_version}-${mod_version}"
|
||||
group = "${mod_base_package}.${mod_id}"
|
||||
archivesBaseName = mod_id
|
||||
|
||||
apply plugin: "net.minecraftforge.gradle.forge"
|
||||
apply plugin: "org.spongepowered.mixin"
|
||||
apply plugin: "com.github.johnrengelman.shadow"
|
||||
apply plugin: "java"
|
||||
|
||||
repositories {
|
||||
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
|
||||
maven {
|
||||
url = 'https://repo.spongepowered.org/repository/maven-public'
|
||||
}
|
||||
}
|
||||
|
||||
version = "1.0.0.0"
|
||||
group = "de.enzaxd.viaforge"
|
||||
archivesBaseName = "ViaForge"
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
compileJava.options.encoding = 'UTF-8'
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
|
||||
compileJava.options.encoding = "UTF-8"
|
||||
|
||||
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
||||
minecraft {
|
||||
version = "1.12.2-14.23.5.2768"
|
||||
runDir = 'run'
|
||||
mappings = "stable_39"
|
||||
makeObfSourceJar = true
|
||||
// The mappings can be changed at any time and must be in the following format.
|
||||
// Channel: Version:
|
||||
// snapshot YYYYMMDD Snapshot are built nightly.
|
||||
// stable # Stables are built at the discretion of the MCP team.
|
||||
// official MCVersion Official field/method names from Mojang mapping files
|
||||
// parchment YYYY.MM.DD-MCVer Javadocs and parameters layered on top of Mojmaps from the ParchmentMC team.
|
||||
//
|
||||
// You must be aware of the Mojang license when using the 'official' / 'parchment' mappings.
|
||||
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
||||
//
|
||||
// Use non-default mappings at your own risk. They may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: mappings_channel, version: mappings_version
|
||||
|
||||
// Default run configurations.
|
||||
// These can be tweaked, removed, or duplicated as needed.
|
||||
runs {
|
||||
client {
|
||||
workingDirectory project.file("run")
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
// The markers can be added/remove as needed separated by commas.
|
||||
// "SCAN": For mods scan.
|
||||
// "REGISTRIES": For firing of registry events.
|
||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||
property 'forge.logging.markers', 'REGISTRIES'
|
||||
|
||||
// Recommended logging level for the console
|
||||
property "forge.logging.console.level", "debug"
|
||||
|
||||
// mixin
|
||||
property 'mixin.debug.export', 'true'
|
||||
property "mixin.hotSwap", "true"
|
||||
property "fml.coreMods.load", "de.enzaxd.viaforge.injection.MixinLoader"
|
||||
// These arguments allow for optional authentication with Mojang servers.
|
||||
// If you want to authenticate, put these properties in GRADLE_HOME/gradle.properties.
|
||||
// By default, this is C:\Users\<your username>\.gradle\gradle.properties on Windows or ~/.gradle/gradle.properties on Linux/MacOS.
|
||||
if (project.hasProperty('mc_uuid')) {
|
||||
// Your UUID, trimmed / without the dashes
|
||||
args '--uuid', project.getProperty('mc_uuid')
|
||||
}
|
||||
if (project.hasProperty('mc_username')) {
|
||||
// Your Minecraft in-game username, not email
|
||||
args '--username', project.getProperty('mc_username')
|
||||
}
|
||||
if (project.hasProperty('mc_accessToken')) {
|
||||
// Your current access token. When it expires, you need to retrieve a new one and regenerate your run configurations.
|
||||
// You may be able to find it in your .minecraft folder in launcher_accounts.json or launcher_profiles.json.
|
||||
args '--accessToken', project.getProperty('mc_accessToken')
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/java'
|
||||
main.java.srcDirs += '../shared/main/java'
|
||||
main.resources.srcDirs += '../shared/main/resources'
|
||||
args '-mixin.config=' + 'mixins.' + project.getProperty('mod_id') + '.json'
|
||||
|
||||
mods {
|
||||
"${mod_id}" {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
|
||||
maven { url 'https://jitpack.io' }
|
||||
maven {
|
||||
name = 'spongepowered-repo'
|
||||
url = 'https://repo.spongepowered.org/maven/'
|
||||
maven { url = "https://repo.spongepowered.org/repository/maven-public" }
|
||||
maven { url = "https://repo.viaversion.com" }
|
||||
}
|
||||
|
||||
configurations {
|
||||
include
|
||||
implementation.extendsFrom(include)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile("org.spongepowered:mixin:0.8") {
|
||||
exclude module: "launchwrapper"
|
||||
}
|
||||
}
|
||||
// Specify the version of Minecraft to use, If this is any group other then "net.minecraft" it is assumed
|
||||
// that the dep is a ForgeGradle "patcher" dependency. And it"s patches will be applied.
|
||||
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
|
||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mcversion", project.minecraft.version
|
||||
// You may put jars on which you depend on in ./libs or you may define them like so..
|
||||
// compile "some.group:artifact:version:classifier"
|
||||
// compile "some.group:artifact:version"
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
// Real examples
|
||||
// compile "com.mod-buildcraft:buildcraft:6.0.8:dev" // adds buildcraft to the dev env
|
||||
// compile "com.googlecode.efficient-java-matrix-library:ejml:0.24" // adds ejml to the dev env
|
||||
|
||||
expand 'version':project.version, 'mcversion':project.minecraft.version
|
||||
}
|
||||
// The "provided" configuration is for optional dependencies that exist at compile-time but might not at runtime.
|
||||
// provided "com.mod-buildcraft:buildcraft:6.0.8:dev"
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'mcmod.info'
|
||||
}
|
||||
// These dependencies get remapped to your current MCP mappings
|
||||
// deobf "com.mod-buildcraft:buildcraft:6.0.8:dev"
|
||||
|
||||
rename '(.+_at.cfg)', 'META-INF/$1'
|
||||
// For more info...
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
|
||||
include "org.spongepowered:mixin:${mixin_version}"
|
||||
include "com.viaversion:viaversion:4.0.2-SNAPSHOT"
|
||||
include "com.viaversion:viabackwards:4.0.2-SNAPSHOT"
|
||||
include "org.yaml:snakeyaml:1.29"
|
||||
|
||||
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
|
||||
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
|
||||
}
|
||||
|
||||
mixin {
|
||||
add sourceSets.main, "mixins.viaforge.refmap.json"
|
||||
add sourceSets.main, "mixins.${mod_id}.refmap.json"
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest.attributes(
|
||||
"MixinConfigs": "mixins.viaforge.json",
|
||||
"tweakClass": "org.spongepowered.asm.launch.MixinTweaker",
|
||||
"TweakOrder": 0,
|
||||
"FMLCorePluginContainsFMLMod": "de.enzaxd.viaforge.injection.MixinLoader"
|
||||
"Specification-Title": "viaforge",
|
||||
"Specification-Vendor": "viaforge",
|
||||
"Specification-Version": "1",
|
||||
"Implementation-Title": project.name,
|
||||
"Implementation-Version": "${archiveVersion}",
|
||||
"Implementation-Vendor" :"viaforge",
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd"-"HH:mm:ssZ"),
|
||||
"TweakClass": "org.spongepowered.asm.launch.MixinTweaker",
|
||||
"TweakOrder": "0",
|
||||
"FMLCorePluginContainsFMLMod": "de.enzaxd.viaforge.injection.MixinLoader",
|
||||
"MixinConfigs": "mixins.${mod_id}.json"
|
||||
)
|
||||
}
|
||||
|
||||
apply plugin: "idea"
|
||||
|
||||
idea {
|
||||
module {
|
||||
inheritOutputDirs = true
|
||||
}
|
||||
enabled = false
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
dependencies {
|
||||
include(dependency('org.spongepowered:mixin'))
|
||||
archiveFileName = jar.archiveFileName
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
configurations = [project.configurations.include]
|
||||
exclude "LICENSE.md"
|
||||
exclude "dummyThing"
|
||||
exclude "**/module-info.class"
|
||||
exclude "*.so"
|
||||
exclude "*.dylib"
|
||||
exclude "*.dll"
|
||||
exclude "*.jnilib"
|
||||
exclude "ibxm/**"
|
||||
exclude "com/jcraft/**"
|
||||
exclude "org/lwjgl/**"
|
||||
exclude "net/java/**"
|
||||
|
||||
exclude "META-INF/proguard/**"
|
||||
exclude "META-INF/maven/**"
|
||||
exclude "META-INF/versions/**"
|
||||
exclude "META-INF/com.android.tools/**"
|
||||
|
||||
exclude "fabric.mod.json"
|
||||
exclude "bungee.yml"
|
||||
exclude "plugin.yml"
|
||||
exclude "velocity-plugin.json"
|
||||
exclude "LICENSE.txt"
|
||||
}
|
||||
|
||||
exclude 'dummyThing'
|
||||
exclude 'LICENSE.txt'
|
||||
|
||||
classifier = ""
|
||||
reobf {
|
||||
shadowJar {}
|
||||
}
|
||||
|
||||
reobf { shadowJar { mappingType = "SEARGE" } }
|
||||
tasks.reobfShadowJar.mustRunAfter shadowJar
|
||||
|
||||
configurations {
|
||||
external
|
||||
compile.extendsFrom external
|
||||
}
|
||||
|
||||
build.dependsOn shadowJar
|
||||
jar.dependsOn("shadowJar")
|
||||
|
17
gradle.properties
Normal file
17
gradle.properties
Normal file
@ -0,0 +1,17 @@
|
||||
# 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
|
||||
org.gradle.daemon=false
|
||||
|
||||
minecraft_version=1.12.2
|
||||
forge_version=14.23.5.2855
|
||||
mappings_channel=stable
|
||||
mappings_version=39-1.12
|
||||
|
||||
mod_id=viaforge
|
||||
mod_name=Viaforge
|
||||
mod_version=1.0.0
|
||||
mod_base_package=de.enzaxd
|
||||
|
||||
# Dependencies
|
||||
mixin_version=0.8.3
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,5 @@
|
||||
#Mon Sep 14 12:28:28 PDT 2015
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https://services.gradle.org/distributions/gradle-4.9-bin.zip
|
||||
|
234
gradlew
vendored
234
gradlew
vendored
@ -0,0 +1,234 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original 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 POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=${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 "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# 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" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
43
gradlew.bat
vendored
43
gradlew.bat
vendored
@ -1,3 +1,19 @@
|
||||
@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
|
||||
@ -13,15 +29,18 @@ 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=
|
||||
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 init
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@ -35,7 +54,7 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
@ -45,28 +64,14 @@ echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
: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 %CMD_LINE_ARGS%
|
||||
"%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
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,18 +1,23 @@
|
||||
/*
|
||||
* This settings file was generated by the Gradle 'init' task.
|
||||
*
|
||||
* The settings file is used to specify which projects to include in your build.
|
||||
* In a single project build this file can be empty or even removed.
|
||||
*
|
||||
* Detailed information about configuring a multi-project build in Gradle can be found
|
||||
* in the user guide at https://docs.gradle.org/4.2.1/userguide/multi_project_builds.html
|
||||
*/
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven { url = "https://maven.minecraftforge.net/" }
|
||||
maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
|
||||
maven { url = "https://jitpack.io/" }
|
||||
}
|
||||
resolutionStrategy {
|
||||
eachPlugin {
|
||||
switch (requested.id.id) {
|
||||
case "net.minecraftforge.gradle":
|
||||
useModule("net.minecraftforge.gradle:ForgeGradle:${requested.version}")
|
||||
break
|
||||
case "org.spongepowered.mixin":
|
||||
useModule("org.spongepowered:mixingradle:${requested.version}")
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// To declare projects as part of a multi-project build use the 'include' method
|
||||
include 'shared'
|
||||
include 'api'
|
||||
include 'services:webservice'
|
||||
*/
|
||||
|
||||
rootProject.name = 'ViaForge'
|
||||
rootProject.name = "ViaForge"
|
@ -9,8 +9,8 @@ import de.enzaxd.viaforge.loader.VRProviderLoader;
|
||||
import de.enzaxd.viaforge.platform.VRInjector;
|
||||
import de.enzaxd.viaforge.platform.VRPlatform;
|
||||
import de.enzaxd.viaforge.utils.JLoggerToLog4j;
|
||||
import io.netty.channel.DefaultEventLoopGroup;
|
||||
import io.netty.channel.EventLoop;
|
||||
import io.netty.channel.local.LocalEventLoopGroup;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import java.io.File;
|
||||
@ -25,26 +25,23 @@ public class ViaForge {
|
||||
public final static int SHARED_VERSION = 340;
|
||||
|
||||
private static final ViaForge instance = new ViaForge();
|
||||
private final Logger jLogger = new JLoggerToLog4j(LogManager.getLogger("ViaForge"));
|
||||
private final CompletableFuture<Void> initFuture = new CompletableFuture<>();
|
||||
private ExecutorService asyncExecutor;
|
||||
private EventLoop eventLoop;
|
||||
private File file;
|
||||
private int version;
|
||||
private String lastServer;
|
||||
|
||||
public static ViaForge getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
private final Logger jLogger = new JLoggerToLog4j(LogManager.getLogger("ViaForge"));
|
||||
private final CompletableFuture<Void> initFuture = new CompletableFuture<>();
|
||||
|
||||
private ExecutorService asyncExecutor;
|
||||
private EventLoop eventLoop;
|
||||
|
||||
private File file;
|
||||
private int version;
|
||||
private String lastServer;
|
||||
|
||||
public void start() {
|
||||
ThreadFactory factory = new ThreadFactoryBuilder().setDaemon(true).setNameFormat("ViaForge-%d").build();
|
||||
asyncExecutor = Executors.newFixedThreadPool(8, factory);
|
||||
|
||||
eventLoop = new LocalEventLoopGroup(1, factory).next();
|
||||
eventLoop = new DefaultEventLoopGroup(1, factory).next();
|
||||
eventLoop.submit(initFuture::join);
|
||||
|
||||
setVersion(SHARED_VERSION);
|
||||
@ -88,22 +85,23 @@ public class ViaForge {
|
||||
return file;
|
||||
}
|
||||
|
||||
public String getLastServer() {
|
||||
return lastServer;
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public void setFile(File file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public String getLastServer() {
|
||||
return lastServer;
|
||||
}
|
||||
|
||||
public void setLastServer(String lastServer) {
|
||||
this.lastServer = lastServer;
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
}
|
||||
|
18
src/main/resources/mcmod.info
Normal file
18
src/main/resources/mcmod.info
Normal file
@ -0,0 +1,18 @@
|
||||
[
|
||||
{
|
||||
"modid": "viaforge",
|
||||
"name": "Viaforge",
|
||||
"description": "Client-side loader for ViaVersion and ViaBackwards.",
|
||||
"version": "1.0.0",
|
||||
"mcversion": "1.12.2",
|
||||
"url": "",
|
||||
"updateUrl": "",
|
||||
"authorList": [
|
||||
"enzaxd"
|
||||
],
|
||||
"credits": "",
|
||||
"logoFile": "",
|
||||
"screenshots": [],
|
||||
"dependencies": []
|
||||
}
|
||||
]
|
@ -1,8 +1,9 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8.3",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"package": "de.enzaxd.viaforge.injection.mixins",
|
||||
"refmap": "mixins.viaforge.refmap.json",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"mixins": [
|
||||
"MixinGuiConnecting",
|
||||
"MixinGuiDisconnected",
|
||||
@ -12,5 +13,6 @@
|
||||
"MixinGuiScreenServerList",
|
||||
"MixinMinecraft",
|
||||
"MixinNetworkManagerChInit"
|
||||
]
|
||||
],
|
||||
"verbose": true
|
||||
}
|
Loading…
Reference in New Issue
Block a user