From bc708133a4f1ffe111ea066d581f27e6c8cc7863 Mon Sep 17 00:00:00 2001 From: AlexIIL Date: Fri, 12 Apr 2024 01:49:04 +0100 Subject: [PATCH] A couple of minor bugfixes: - Fixed access transformers only being applied to minecraft, and not whatever the current game is. - Fixed BuiltinModOption attempting to close the default file system. --- gradle.properties | 2 +- .../java/org/quiltmc/loader/impl/QuiltLoaderImpl.java | 2 +- .../loader/impl/plugin/quilt/BuiltinModOption.java | 3 ++- .../quiltmc/loader/impl/transformer/QuiltTransformer.java | 8 ++++---- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 872442e49..e303b9599 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ group = org.quiltmc description = The mod loading component of Quilt url = https://github.com/quiltmc/quilt-loader # Don't forget to change this in QuiltLoaderImpl as well -quilt_loader = 0.25.0-beta.3 +quilt_loader = 0.25.0-beta.4 # Fabric & Quilt Libraries asm = 9.6 diff --git a/src/main/java/org/quiltmc/loader/impl/QuiltLoaderImpl.java b/src/main/java/org/quiltmc/loader/impl/QuiltLoaderImpl.java index 49fb0c7a7..5be39b72c 100644 --- a/src/main/java/org/quiltmc/loader/impl/QuiltLoaderImpl.java +++ b/src/main/java/org/quiltmc/loader/impl/QuiltLoaderImpl.java @@ -132,7 +132,7 @@ public final class QuiltLoaderImpl { public static final int ASM_VERSION = Opcodes.ASM9; - public static final String VERSION = "0.25.0-beta.3"; + public static final String VERSION = "0.25.0-beta.4"; public static final String MOD_ID = "quilt_loader"; public static final String DEFAULT_MODS_DIR = "mods"; public static final String DEFAULT_CACHE_DIR = ".cache"; diff --git a/src/main/java/org/quiltmc/loader/impl/plugin/quilt/BuiltinModOption.java b/src/main/java/org/quiltmc/loader/impl/plugin/quilt/BuiltinModOption.java index 31061036a..c83cd15a0 100644 --- a/src/main/java/org/quiltmc/loader/impl/plugin/quilt/BuiltinModOption.java +++ b/src/main/java/org/quiltmc/loader/impl/plugin/quilt/BuiltinModOption.java @@ -17,6 +17,7 @@ package org.quiltmc.loader.impl.plugin.quilt; import java.io.IOException; +import java.nio.file.FileSystems; import java.nio.file.Path; import org.quiltmc.loader.api.gui.QuiltLoaderIcon; @@ -52,7 +53,7 @@ protected String nameOfType() { @Override public ModContainerExt convertToMod(Path transformedResourceRoot) { - if (!transformedResourceRoot.equals(resourceRoot)) { + if (!transformedResourceRoot.equals(resourceRoot) && resourceRoot.getFileSystem() != FileSystems.getDefault()) { try { resourceRoot.getFileSystem().close(); } catch (IOException e) { diff --git a/src/main/java/org/quiltmc/loader/impl/transformer/QuiltTransformer.java b/src/main/java/org/quiltmc/loader/impl/transformer/QuiltTransformer.java index 3b6a55409..eba9e7942 100644 --- a/src/main/java/org/quiltmc/loader/impl/transformer/QuiltTransformer.java +++ b/src/main/java/org/quiltmc/loader/impl/transformer/QuiltTransformer.java @@ -37,10 +37,10 @@ @QuiltLoaderInternal(QuiltLoaderInternalType.NEW_INTERNAL) final class QuiltTransformer { public static byte @Nullable [] transform(boolean isDevelopment, EnvType envType, TransformCache cache, AccessWidener accessWidener, String name, ModLoadOption mod, byte[] bytes) { - boolean isMinecraftClass = mod.id().equals("minecraft"); - boolean transformAccess = isMinecraftClass && QuiltLauncherBase.getLauncher().getMappingConfiguration().requiresPackageAccessHack(); - boolean strip = !isMinecraftClass || isDevelopment; - boolean applyAccessWidener = isMinecraftClass && accessWidener.getTargets().contains(name); + boolean isGameClass = mod.id().equals(QuiltLoaderImpl.INSTANCE.getGameProvider().getGameId()); + boolean transformAccess = isGameClass && QuiltLauncherBase.getLauncher().getMappingConfiguration().requiresPackageAccessHack(); + boolean strip = !isGameClass || isDevelopment; + boolean applyAccessWidener = isGameClass && accessWidener.getTargets().contains(name); if (!transformAccess && !strip && !applyAccessWidener) { return bytes;