Skip to content

Commit

Permalink
Fixed default entrypoints not being called.
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSVK12 committed Dec 9, 2024
1 parent a7e306d commit 3cbac14
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@

package net.fabricmc.loader.impl.game.minecraft.patch;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ListIterator;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;

import net.fabricmc.loader.impl.game.minecraft.applet.AppletLauncher;

Expand Down Expand Up @@ -460,12 +464,13 @@ public void process(FabricLauncher launcher, Function<String, ClassNode> classSo
moveAfter(it, Opcodes.INVOKESPECIAL); /* Object.init */
it.add(new FieldInsnNode(Opcodes.GETSTATIC, gameClass.name, runDirectory.name, runDirectory.desc));
it.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "net/fabricmc/loader/impl/game/minecraft/applet/AppletMain", "hookGameDir", "(Ljava/io/File;)Ljava/io/File;", false));
it.add(new FieldInsnNode(Opcodes.PUTSTATIC, gameClass.name, runDirectory.name, runDirectory.desc));
FieldInsnNode node = new FieldInsnNode(Opcodes.PUTSTATIC, gameClass.name, runDirectory.name, runDirectory.desc);
it.add(node);

it = gameMethod.instructions.iterator();

if (gameConstructor == gameMethod) {
moveBefore(it, Opcodes.RETURN);
moveBefore(it,Opcodes.IFEQ);
}

it.add(new FieldInsnNode(Opcodes.GETSTATIC, gameClass.name, runDirectory.name, runDirectory.desc));
Expand Down Expand Up @@ -532,7 +537,7 @@ public void process(FabricLauncher launcher, Function<String, ClassNode> classSo
classEmitter.accept(mainClass);
}

if (isApplet) {
if (isApplet || isDirect) {
Hooks.appletMainClass = entrypoint;
}
}
Expand Down

0 comments on commit 3cbac14

Please sign in to comment.