Skip to content

Commit c15b95e

Browse files
committed
Fix mixin.perf.resourcepacks overwriting Fusion patches
Related: #392
1 parent d7f2e90 commit c15b95e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

forge/src/main/java/org/embeddedt/modernfix/forge/mixin/perf/resourcepacks/ForgePathPackResourcesMixin.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import java.util.Objects;
2828
import java.util.Set;
2929

30-
@Mixin(PathPackResources.class)
30+
@Mixin(value = PathPackResources.class, priority = 1100)
3131
public abstract class ForgePathPackResourcesMixin implements ICachingResourcePack {
3232
@Shadow(remap = false) protected abstract Path resolve(String... paths);
3333

@@ -75,14 +75,15 @@ public void invalidateCache() {
7575
this.cacheEngine = null;
7676
}
7777

78-
@Inject(method = "getNamespaces", at = @At("HEAD"), cancellable = true)
79-
private void useCacheForNamespaces(PackType type, CallbackInfoReturnable<Set<String>> cir) {
78+
@Redirect(method = "getNamespaces", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/resource/PathPackResources;getNamespacesFromDisk(Lnet/minecraft/server/packs/PackType;)Ljava/util/Set;"))
79+
private Set<String> useCacheForNamespaces(PathPackResources instance, PackType type) {
8080
PackResourcesCacheEngine engine = cacheEngine;
8181
if(engine != null) {
8282
Set<String> namespaces = engine.getNamespaces(type);
8383
if(namespaces != null)
84-
cir.setReturnValue(namespaces);
84+
return namespaces;
8585
}
86+
return this.getNamespacesFromDisk(type);
8687
}
8788

8889
@Redirect(method = "getRootResource", at = @At(value = "INVOKE", target = "Ljava/nio/file/Files;exists(Ljava/nio/file/Path;[Ljava/nio/file/LinkOption;)Z"))

0 commit comments

Comments
 (0)