Skip to content

Commit

Permalink
Update build script. Merge micromixin into main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Lassebq committed Oct 5, 2024
1 parent 2362456 commit d61bad4
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 42 deletions.
48 changes: 29 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,24 @@ plugins {
id 'maven-publish'
}

archivesBaseName = 'launchwrapper'
def ENV = System.getenv()

project.ext.asm_version = 9.7
group = 'org.mcphackers'
version = 1.0
if(!ENV.RELEASE.equals('1')) {
project.version += '-SNAPSHOT'
}

def ENV = System.getenv()
def asm_version = 9.7
def depends = [
"org.mcphackers.rdi:rdi:1.0",
"org.ow2.asm:asm:${asm_version}",
"org.ow2.asm:asm-util:${asm_version}",
"org.ow2.asm:asm-tree:${asm_version}",
"org.json:json:20240303"
]

dependencies {
implementation "org.mcphackers.rdi:rdi:1.0"
implementation "org.ow2.asm:asm:${project.asm_version}"
implementation "org.ow2.asm:asm-util:${project.asm_version}"
implementation "org.ow2.asm:asm-tree:${project.asm_version}"
implementation "org.json:json:20240303"
// I'll bring discord RPC support later, when I have an environment to compile natives

testRuntimeOnly('org.junit.platform:junit-platform-launcher:1.5.2')
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.0.0'
}
Expand All @@ -30,15 +34,20 @@ test {
}
}

allprojects {
subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'

group = 'org.mcphackers'
project.version = '1.0'
if(!ENV.RELEASE.equals('1')) {
project.version += '-SNAPSHOT'
}
project.group = rootProject.group
project.version = rootProject.version

dependencies {
implementation rootProject
}
}

allprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'

repositories {
maven {
Expand All @@ -49,6 +58,9 @@ allprojects {
}
mavenCentral()
}
dependencies {
depends.each { depend -> implementation depend }
}

task sourcesJar(type: Jar) {
archiveClassifier = 'sources'
Expand Down Expand Up @@ -94,8 +106,6 @@ allprojects {
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = project.archivesBaseName

artifact jar
artifact sourcesJar
}
Expand Down
6 changes: 0 additions & 6 deletions launchwrapper-fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@ repositories {
}
}

archivesBaseName = 'launchwrapper-fabric'
compileJava {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

dependencies {
implementation rootProject
implementation "org.mcphackers.rdi:rdi:1.0"
implementation "net.fabricmc:fabric-loader:0.16.4"
implementation "org.ow2.asm:asm:${project.asm_version}"
implementation "org.ow2.asm:asm-tree:${project.asm_version}"
implementation "org.ow2.asm:asm-util:${project.asm_version}"
}
7 changes: 0 additions & 7 deletions launchwrapper-micromixin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@ repositories {
}
}

archivesBaseName = 'launchwrapper-micromixin'
compileJava {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

dependencies {
implementation rootProject
implementation "org.mcphackers.rdi:rdi:1.0"
implementation 'org.json:json:20230311'
implementation 'org.jetbrains:annotations-java5:24.1.0'
implementation "org.stianloader:micromixin-transformer:0.6.5-a20240922"
implementation "org.stianloader:micromixin-runtime:0.6.5-a20240922"
Expand All @@ -27,7 +23,4 @@ dependencies {
implementation "org.stianloader:stianloader-remapper:0.1.0-a20240601" // For remapping classes and references
implementation "net.fabricmc:mapping-io:0.3.0"
implementation "net.fabricmc:access-widener:2.1.0"
implementation "org.ow2.asm:asm:${project.asm_version}"
implementation "org.ow2.asm:asm-tree:${project.asm_version}"
implementation "org.ow2.asm:asm-util:${project.asm_version}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ protected URLConnection openConnection(URL url) throws IOException {
// if(path.equals("/worlds/test/$LOCATION_ID"))
// return new BasicResponseURLConnection(url, "1");
}
//FIXME server sends their own skin as packet
if(host.equals("textures.minecraft.net")) {
if(path.startsWith("/texture/")) {
return new TextureURLConnection(url, skins);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import static org.mcphackers.rdi.util.InsnHelper.*;
import static org.objectweb.asm.Opcodes.*;

import java.util.ArrayList;
import java.util.List;

import org.mcphackers.launchwrapper.LaunchConfig;
import org.mcphackers.launchwrapper.tweak.injection.InjectionWithContext;
import org.mcphackers.launchwrapper.tweak.injection.MinecraftGetter;
Expand Down Expand Up @@ -498,7 +495,6 @@ public boolean patchErrorScreen(ClassNodeSource source, ClassNode errScreen, Met
}
}
// Cancel button patch
// TODO don't patch button if it's already present
ClassNode screen = source.getClass(errScreen.superName);
cancelButton:
if(screen != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,13 @@ && compareInsn(insns3[6], INVOKESPECIAL, "org/lwjgl/opengl/DisplayMode", "<init>
while(insn2 != null) {
AbstractInsnNode[] insns2 = fill(insn2, 4);
if(compareInsn(insns2[0], INVOKESTATIC, "org/lwjgl/opengl/Display", "setFullscreen", "(Z)V")
&& compareInsn(insns2[1], INVOKESTATIC, "org/lwjgl/opengl/Display", "update", "()V")
&& compareInsn(insns2[2], LDC, 1000L)
&& compareInsn(insns2[3], INVOKESTATIC, "java/lang/Thread", "sleep", "(J)V")) {
&& compareInsn(insns2[1], INVOKESTATIC, "org/lwjgl/opengl/Display", "update", "()V")) {
// Removes fullscreen delay
m.instructions.remove(insns2[2]);
m.instructions.remove(insns2[3]);
if(compareInsn(insns2[2], LDC, 1000L)
&& compareInsn(insns2[3], INVOKESTATIC, "java/lang/Thread", "sleep", "(J)V")) {
m.instructions.remove(insns2[2]);
m.instructions.remove(insns2[3]);
}
toggleFullscreen = m;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public Tweak getTweak(LaunchConfig config) {
@Override
public TestFeatureBuilder getTests() {
return new TestFeatureBuilder()
//TODO LWJGL patch is applied partially so it doesn't "succeed"
.tweakInfoList("LegacyTweak init", "Fix Shutdown", "Replace game directory");
}

Expand Down

0 comments on commit d61bad4

Please sign in to comment.