Skip to content

Commit

Permalink
Full support the installation of forge-1.16.5-36.1.66+ and partial su…
Browse files Browse the repository at this point in the history
…pport forge-1.17.1
  • Loading branch information
ZekerZhayard committed Jul 24, 2021
1 parent 3aeeada commit 5fb3f01
Show file tree
Hide file tree
Showing 23 changed files with 458 additions and 82 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
build:
runs-on: windows-latest
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
Expand All @@ -18,7 +18,9 @@ jobs:
java-version: '8.0.302'
architecture: x64
- name: Build with Gradle
run: ./gradlew.bat build -iS
run: |
chmod +x ./gradlew
./gradlew build -iS
- uses: actions/upload-artifact@v2
with:
name: Package
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/maven.bat

This file was deleted.

13 changes: 8 additions & 5 deletions .github/workflows/publication.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
build:
runs-on: windows-latest
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
Expand All @@ -19,7 +19,9 @@ jobs:
- name: Build with Gradle
env:
IS_PUBLICATION: true
run: ./gradlew.bat publish -iS
run: |
chmod +x ./gradlew
./gradlew publish -iS
- uses: actions/upload-artifact@v2
with:
name: Package
Expand Down Expand Up @@ -49,6 +51,7 @@ jobs:
with:
asset_paths: '["./build/libs/*"]'
- name: Upload to Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./.github/workflows/maven.bat
uses: JamesIves/[email protected]
with:
branch: maven
folder: build/maven
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ bin
*.iml
*.ipr
*.iws
out
out
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Allow [MultiMC](https://github.com/MultiMC/MultiMC5) to launch Minecraft 1.13+ w

1. Download Forge installer for Minecraft 1.13+ [here](https://files.minecraftforge.net/).
2. Download ForgeWrapper jar file at the [release](https://github.com/ZekerZhayard/ForgeWrapper/releases) page.
3. Since ForgeWrapper 1.5.1, it no longer includes the json converter, so you need to build it by yourself:
- [Download](https://github.com/ZekerZhayard/ForgeWrapper/archive/refs/heads/master.zip) ForgeWrapper sources.
- Extract the zip and open terminal in the extracted folder.
- Run `./gradlew build` command in terminal and get the jar from `./converter/build/libs`
3. Run the below command in terminal:
```
java -jar <ForgeWrapper.jar> --installer=<forge-installer.jar> [--instance=<instance-path>]
Expand Down
38 changes: 14 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ plugins {
}

sourceCompatibility = targetCompatibility = 1.8
compileJava {
sourceCompatibility = targetCompatibility = 1.8
}

version = "${fw_version}${-> getVersionSuffix()}"
group = "io.github.zekerzhayard"
Expand All @@ -15,6 +18,9 @@ configurations {
provided {
compileOnly.extendsFrom provided
}
multirelase {
compileOnly.extendsFrom multirelase
}
}

repositories {
Expand All @@ -26,12 +32,13 @@ repositories {
}

dependencies {
compileOnly "com.google.code.gson:gson:2.8.7"
compileOnly "com.google.code.gson:gson:2.8.5"
compileOnly "cpw.mods:modlauncher:8.0.9"
compileOnly "net.minecraftforge:installer:2.1.4"
compileOnly "net.sf.jopt-simple:jopt-simple:5.0.4"

provided project(":legacy")
multirelase project(":jigsaw")
}

java {
Expand All @@ -48,37 +55,20 @@ jar {
"Implementation-Vendor" :"ZekerZhayard",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"Automatic-Module-Name": "${project.group}.${project.archivesBaseName}".toString().toLowerCase(),
"Multi-Release": "true",
"Main-Class": "io.github.zekerzhayard.forgewrapper.converter.Main",
"GitCommit": String.valueOf(System.getenv("GITHUB_SHA"))
])

from configurations.provided.files.collect {
zipTree(it)
}
}

/*task sourcesJar(type: Jar) {
manifest {
attributes(jar.manifest.attributes)
}
from sourceSets.main.allSource
archiveFileName = "${archivesBaseName}-${archiveVersion.get()}-sources.${archiveExtension.get()}"
}
artifacts {
archives sourcesJar
}*/

processResources {
inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
include "patches/net.minecraftforge.json"
expand "version": project.version
}
from(sourceSets.main.resources.srcDirs) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
exclude "patches/net.minecraftforge.json"
into "META-INF/versions/9", {
from configurations.multirelase.files.collect {
zipTree(it)
}
exclude "META-INF/**"
}
}

Expand Down
48 changes: 48 additions & 0 deletions converter/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

plugins {
id "java"
id "eclipse"
}

version = "${rootProject.fw_version}${-> getVersionSuffix()}"
group = "io.github.zekerzhayard"
archivesBaseName = rootProject.name + "Converter"

configurations {
provided {
compileOnly.extendsFrom provided
}
}

repositories {
mavenCentral()
}

dependencies {
compileOnly "com.google.code.gson:gson:2.8.5"
provided rootProject
}

jar {
manifest.attributes rootProject.jar.manifest.attributes
manifest.attributes([
"Main-Class": "io.github.zekerzhayard.forgewrapper.converter.Main"
])

from configurations.provided.files.collect {
zipTree(it)
}
}

processResources {
inputs.property "version", project.version
from(sourceSets.main.resources.srcDirs) {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
include "patches/net.minecraftforge.json"
expand "version": project.version
}
from(sourceSets.main.resources.srcDirs) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
exclude "patches/net.minecraftforge.json"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ private static JsonObject convertPatchesJson(JsonObject installer, JsonObject in
}
Map<String, String> additionalUrls = new HashMap<>();
String path = String.format("net/minecraftforge/forge/%s-%s/forge-%s-%s", mcVersion, forgeVersion, mcVersion, forgeVersion);
additionalUrls.put(path + "-universal.jar", "https://files.minecraftforge.net/maven/" + path + "-universal.jar");
additionalUrls.put(path + "-universal.jar", "https://maven.minecraftforge.net/" + path + "-universal.jar");
transformLibraries(getElement(installProfile, "libraries").getAsJsonArray(), mavenFiles, additionalUrls);
additionalUrls.clear();
additionalUrls.put(path + ".jar", "https://files.minecraftforge.net/maven/" + path + "-launcher.jar");
transformLibraries(getElement(installer ,"libraries").getAsJsonArray(), libraries, additionalUrls);
additionalUrls.put(path + ".jar", "https://maven.minecraftforge.net/" + path + "-launcher.jar");
transformLibraries(getElement(installer, "libraries").getAsJsonArray(), libraries, additionalUrls);

patches.addProperty("version", forgeVersion);
for (JsonElement require : getElement(patches, "requires").getAsJsonArray()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"uid": "net.minecraftforge"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
"MMC-filename": "ForgeWrapper-${version}.jar"
}
]
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

org.gradle.daemon = false

fw_version = 1.5
fw_version = 1.5.1
28 changes: 28 additions & 0 deletions jigsaw/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

plugins {
id "java"
id "eclipse"
}

compileJava {
if (JavaVersion.current() < JavaVersion.VERSION_1_9) {
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(9)
}
}
sourceCompatibility = 9
targetCompatibility = 9
}

configurations {
apiElements {
attributes {
attribute TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 8
}
}
runtimeElements {
attributes {
attribute TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 8
}
}
}
Loading

0 comments on commit 5fb3f01

Please sign in to comment.