Skip to content

Commit c40012c

Browse files
committed
Fix @Requires("quilt_loader") not working because the transform cache doesn't contain it.
1 parent 3b039d5 commit c40012c

File tree

7 files changed

+22
-14
lines changed

7 files changed

+22
-14
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ group = org.quiltmc
55
description = The mod loading component of Quilt
66
url = https://github.com/quiltmc/quilt-loader
77
# Don't forget to change this in QuiltLoaderImpl as well
8-
quilt_loader = 0.24.1-beta.1
8+
quilt_loader = 0.24.1-beta.2
99

1010
# Fabric & Quilt Libraries
1111
asm = 9.6

src/main/java/org/quiltmc/loader/impl/QuiltLoaderImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public final class QuiltLoaderImpl {
132132

133133
public static final int ASM_VERSION = Opcodes.ASM9;
134134

135-
public static final String VERSION = "0.24.1-beta.1";
135+
public static final String VERSION = "0.24.1-beta.2";
136136
public static final String MOD_ID = "quilt_loader";
137137
public static final String DEFAULT_MODS_DIR = "mods";
138138
public static final String DEFAULT_CACHE_DIR = ".cache";

src/main/java/org/quiltmc/loader/impl/transformer/ChasmInvoker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static void applyChasm0(TransformCache cache) throws IOException {
6969
Map<String, byte[]> inputClassCache = new HashMap<>();
7070

7171
// TODO: Move chasm searching to here!
72-
for (ModLoadOption mod : cache.getMods()) {
72+
for (ModLoadOption mod : cache.getModsInCache()) {
7373
Path path2 = cache.getRoot(mod);
7474
if (!FasterFiles.isDirectory(path2)) {
7575
continue;
@@ -108,7 +108,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
108108
}
109109
});
110110

111-
for (ModLoadOption mod : cache.getMods()) {
111+
for (ModLoadOption mod : cache.getModsInCache()) {
112112
Path modPath = cache.getRoot(mod);
113113
if (!FasterFiles.exists(modPath)) {
114114
continue;

src/main/java/org/quiltmc/loader/impl/transformer/QuiltTransformer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ final class QuiltTransformer {
5252
int visitorCount = 0;
5353

5454
if (strip) {
55-
ClassStrippingData data = new ClassStrippingData(QuiltLoaderImpl.ASM_VERSION, envType, cache.getMods());
55+
ClassStrippingData data = new ClassStrippingData(QuiltLoaderImpl.ASM_VERSION, envType, cache.getAllMods());
5656
classReader.accept(data, ClassReader.SKIP_CODE | ClassReader.SKIP_FRAMES);
5757

5858
if (data.stripEntireClass()) {

src/main/java/org/quiltmc/loader/impl/transformer/RuntimeModRemapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ final class RuntimeModRemapper {
6464
static final boolean COPY_ON_WRITE = true;
6565

6666
public static void remap(TransformCache cache) {
67-
List<ModLoadOption> modsToRemap = cache.getMods().stream()
67+
List<ModLoadOption> modsToRemap = cache.getModsInCache().stream()
6868
.filter(modLoadOption -> modLoadOption.namespaceMappingFrom() != null)
6969
.collect(Collectors.toList());
7070
Set<InputTag> remapMixins = new HashSet<>();

src/main/java/org/quiltmc/loader/impl/transformer/TransformCache.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,17 @@
5757
class TransformCache {
5858
private final Path root;
5959
private final Map<ModLoadOption, Path> modRoots = new HashMap<>();
60-
private final List<ModLoadOption> orderedMods;
60+
private final List<ModLoadOption> allMods;
61+
private final List<ModLoadOption> modsInCache;
6162
private final Map<String, String> hiddenClasses = new HashMap<>();
6263
private static final boolean COPY_ON_WRITE = true;
6364

6465
public TransformCache(Path root, List<ModLoadOption> orderedMods) {
6566
this.root = root;
66-
this.orderedMods = orderedMods.stream().filter(mod -> mod.needsTransforming() && !QuiltLoaderImpl.MOD_ID.equals(mod.id())).collect(Collectors.toList());
67+
this.allMods = orderedMods;
68+
this.modsInCache = orderedMods.stream().filter(mod -> mod.needsTransforming() && !QuiltLoaderImpl.MOD_ID.equals(mod.id())).collect(Collectors.toList());
6769

68-
for (ModLoadOption mod : this.orderedMods) {
70+
for (ModLoadOption mod : this.modsInCache) {
6971
Path modSrc = mod.createTransformRoot();
7072
Path modDst = root.resolve(mod.id());
7173
modRoots.put(mod, modDst);
@@ -152,7 +154,7 @@ public TransformCache(Path root, List<ModLoadOption> orderedMods) {
152154
}
153155
// Populate mods that need remapped
154156
RuntimeModRemapper.remap(this);
155-
for (ModLoadOption orderedMod : this.orderedMods) {
157+
for (ModLoadOption orderedMod : this.modsInCache) {
156158
modRoots.put(orderedMod, root.resolve(orderedMod.id() + "/"));
157159
}
158160
}
@@ -161,8 +163,14 @@ public Path getRoot(ModLoadOption mod) {
161163
return modRoots.get(mod);
162164
}
163165

164-
public List<ModLoadOption> getMods() {
165-
return Collections.unmodifiableList(orderedMods);
166+
/** @return Every mod which has a {@link #getRoot(ModLoadOption)} in this cache. */
167+
public List<ModLoadOption> getModsInCache() {
168+
return Collections.unmodifiableList(modsInCache);
169+
}
170+
171+
/** @return The original list of mods, including any which aren't directly in this cache. */
172+
public List<ModLoadOption> getAllMods() {
173+
return Collections.unmodifiableList(allMods);
166174
}
167175

168176
public Map<String, String> getHiddenClasses() {
@@ -171,7 +179,7 @@ public Map<String, String> getHiddenClasses() {
171179

172180
public void forEachClassFile(ClassConsumer action)
173181
throws IOException {
174-
for (ModLoadOption mod : orderedMods) {
182+
for (ModLoadOption mod : modsInCache) {
175183
visitFolder(mod, getRoot(mod), action);
176184
}
177185
}

src/main/java/org/quiltmc/loader/impl/transformer/TransformCacheGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private static AccessWidener loadAccessWideners(TransformCache cache) {
102102
AccessWidener ret = new AccessWidener();
103103
AccessWidenerReader accessWidenerReader = new AccessWidenerReader(ret);
104104

105-
for (ModLoadOption mod : cache.getMods()) {
105+
for (ModLoadOption mod : cache.getModsInCache()) {
106106
for (String accessWidener : mod.metadata().accessWideners()) {
107107

108108
Path path = cache.getRoot(mod).resolve(accessWidener);

0 commit comments

Comments
 (0)