File tree Expand file tree Collapse file tree 3 files changed +37
-2
lines changed
forge/src/main/java/org/embeddedt/modernfix/forge/mixin/bugfix/ctm_resourceutil_cme Expand file tree Collapse file tree 3 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ Some fixes are based on prior work in various Forge PRs (check commit history an
66is directly derived from Sodium and used under the terms of the LGPL-3.0 license.
77
88## Development builds (generally stable, but may occasionally have bugs)
9- - 1.16.5, both modloaders: https://nightly.link/embeddedt/ModernFix/workflows/gradle/main /Package.zip
9+ - 1.16.5, both modloaders: https://nightly.link/embeddedt/ModernFix/workflows/gradle/1.16 /Package.zip
1010- 1.18.2, both modloaders: https://nightly.link/embeddedt/ModernFix/workflows/gradle/1.18/Package.zip
1111- 1.19.2, both modloaders: https://nightly.link/embeddedt/ModernFix/workflows/gradle/1.19.2/Package.zip
1212- 1.19.4, both modloaders: https://nightly.link/embeddedt/ModernFix/workflows/gradle/1.19.4/Package.zip
Original file line number Diff line number Diff line change @@ -183,4 +183,4 @@ tasks.register('checkCleanTag') {
183183 throw new GradleException (' Not a clean tree.' )
184184 }
185185 }
186- }
186+ }
Original file line number Diff line number Diff line change 1+ package org .embeddedt .modernfix .forge .mixin .bugfix .ctm_resourceutil_cme ;
2+
3+ import org .embeddedt .modernfix .annotation .ClientOnlyMixin ;
4+ import org .embeddedt .modernfix .annotation .RequiresMod ;
5+ import org .spongepowered .asm .mixin .Final ;
6+ import org .spongepowered .asm .mixin .Mixin ;
7+ import org .spongepowered .asm .mixin .Mutable ;
8+ import org .spongepowered .asm .mixin .Shadow ;
9+ import org .spongepowered .asm .mixin .injection .At ;
10+ import org .spongepowered .asm .mixin .injection .Inject ;
11+ import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
12+ import team .chisel .ctm .client .util .ResourceUtil ;
13+
14+ import java .util .Collections ;
15+ import java .util .Map ;
16+ import java .util .concurrent .ConcurrentMap ;
17+
18+ @ Mixin (ResourceUtil .class )
19+ @ RequiresMod ("ctm" )
20+ @ ClientOnlyMixin
21+ @ SuppressWarnings ({"rawtypes" , "unchecked" })
22+ public class ResourceUtilMixin {
23+ @ Shadow @ Final @ Mutable
24+ private static Map metadataCache ;
25+
26+ /**
27+ * @author embeddedt
28+ * @reason quick fix to prevent rare CMEs
29+ */
30+ @ Inject (method = "<clinit>" , at = @ At ("RETURN" ))
31+ private static void synchronizeMetadataCache (CallbackInfo ci ) {
32+ if (!(metadataCache instanceof ConcurrentMap ))
33+ metadataCache = Collections .synchronizedMap (metadataCache );
34+ }
35+ }
You can’t perform that action at this time.
0 commit comments