(feat) UNIMINED port

This commit is contained in:
Refactoring 2024-02-11 12:21:04 -05:00
parent 04b94b4556
commit 2974616d81
5 changed files with 59 additions and 104 deletions

View File

@ -1,29 +1,37 @@
# Automatically build the project and run any configured tests for every push
# and submitted pull request. This can help catch issues that only occur on
# certain Java versions, and provides a first line of defence against bad commits.
name: Build
on: [push, pull_request]
name: Building JAR
on: [workflow_dispatch, push]
jobs:
build:
gradle:
strategy:
matrix:
java: [
"8", "11", "17", # LTS
"21" # Latest version
]
runs-on: ubuntu-latest
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- id: commit
uses: pr-mpt/actions-commit-hash@v2
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v6
- uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: ${{ matrix.java }}
distribution: temurin
java-version: 8
- name: Grant execute permission
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Execute Gradle build
run: ./gradlew setupDecompWorkspace clean build --refresh-dependencies
- name: Copying JAR to AutoBuilder
working-directory: ./autobuilder
run: mkdir ./jars && cp ../build/libs/client-1.8.9.jar ./jars/Client.jar
# - name: Obfuscating Jar
# working-directory: ./autobuilder
# run: mkdir ./jars && java -jar obfuscator.jar --jarIn ../build/libs/client-1.8.9.jar --jarOut ./jars/Client.jar --scriptFile obfuscationScript.js --config config
- name: Building Jar with Libraries
working-directory: ./autobuilder
run: npm install && LOGIN=${{ secrets.LOGIN }} PASSWORD=${{ secrets.PASSWORD }} node index --version 1.8.9 --branch ${{ steps.branch-name.outputs.current_branch }} --commit ${{ steps.commit.outputs.short }}

View File

@ -53,11 +53,22 @@ processResources {
inputs.property "version", project.version
}
configurations {
embed
implementation.extendsFrom(embed)
}
dependencies {
implementation("com.github.heni123321:LegacyLauncher:ac106bbe00") {
embed("com.github.heni123321:LegacyLauncher:ac106bbe00") {
transitive = false
}
implementation 'org.spongepowered:mixin:0.7.11-SNAPSHOT'
embed("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'gson'
exclude module: 'commons-io'
}
implementation fileTree(dir: 'lib', include: ['*.jar'])
}
java {
@ -71,6 +82,22 @@ jar {
from("LICENSE") {
rename { "${it}_${base.archivesName.get()}" }
}
from {
configurations.embed.collect {
it.isDirectory() ? it : zipTree(it)
}
}
manifest.attributes(
"MixinConfigs": 'mixins.SilentClient.json',
"TweakClass": "net.silentclient.client.mixin.SilentClientTweaker",
"TweakOrder": 0,
"Manifest-Version": 1.0
)
configurations.embed.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
}
tasks.withType(JavaCompile).configureEach {

View File

@ -8,6 +8,6 @@ import org.apache.commons.lang3.ArrayUtils;
*/
public class Main {
public static void main(String[] args) {
Launch.main(ArrayUtils.addAll(args, "--tweakClass", "dev.refactoring.launch.tweak.LaunchTweaker"));
Launch.main(ArrayUtils.addAll(args, "--tweakClass", "net.silentclient.client.mixin.SilentClientTweaker"));
}
}

View File

@ -1,62 +0,0 @@
package dev.refactoring.launch.tweak;
import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.LaunchClassLoader;
import org.spongepowered.asm.launch.MixinBootstrap;
import org.spongepowered.asm.mixin.MixinEnvironment;
import org.spongepowered.asm.mixin.Mixins;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* @author refactoring
*/
public class LaunchTweaker implements ITweaker {
private final List<String> launchArguments = new ArrayList<>();
@Override
public void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile) {
this.launchArguments.addAll(args);
if (!args.contains("--version") && profile != null) {
launchArguments.add("--version");
launchArguments.add(profile);
}
if (!args.contains("--assetsDir") && assetsDir != null) {
launchArguments.add("--assetsDir");
launchArguments.add(assetsDir.getAbsolutePath());
}
if (!args.contains("--gameDir") && gameDir != null) {
launchArguments.add("--gameDir");
launchArguments.add(gameDir.getAbsolutePath());
}
}
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
MixinBootstrap.init();
MixinEnvironment env = MixinEnvironment.getDefaultEnvironment();
Mixins.addConfiguration("mixins.example.json");
if (env.getObfuscationContext() == null) {
env.setObfuscationContext("notch");
}
env.setSide(MixinEnvironment.Side.CLIENT);
}
@Override
public String getLaunchTarget() {
return "net.minecraft.client.main.Main";
}
@Override
public String[] getLaunchArguments() {
return launchArguments.toArray(new String[0]);
}
}

View File

@ -1,18 +0,0 @@
package dev.refactoring.mixin;
import net.minecraft.client.Minecraft;
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;
/**
* @author refactoring
*/
@Mixin(Minecraft.class)
public class MinecraftMixin {
@Inject(method = "startGame", at = @At("HEAD"))
public void example$startGame(CallbackInfo ci) {
System.out.printf("hello %s\n", ci.getId());
}
}