File tree Expand file tree Collapse file tree 3 files changed +50
-4
lines changed
forge/src/main/java/org/embeddedt/modernfix/forge/mixin/bugfix/ctm_resourceutil_cme Expand file tree Collapse file tree 3 files changed +50
-4
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 @@ -13,7 +13,7 @@ architectury {
1313 minecraft = rootProject. minecraft_version
1414}
1515
16- ext. archives_base_name = ' modernfix-mc ' + minecraft_version
16+ ext. archives_base_name = ' modernfix'
1717
1818allprojects {
1919 apply plugin : " java"
@@ -28,7 +28,18 @@ allprojects {
2828 }
2929
3030 group = ' org.embeddedt'
31- version = gitVersion()
31+ // extract base version from tag, generate other metadata ourselves
32+ def details = versionDetails()
33+ def plusIndex = details. lastTag. indexOf(" +" )
34+ if (plusIndex == -1 ) {
35+ plusIndex = details. lastTag. length()
36+ }
37+ def baseVersion = details. lastTag. substring(0 , plusIndex)
38+ def dirtyMarker = details. isCleanTag ? " " : " .dirty"
39+ def commitHashMarker = details. commitDistance > 0 ? (" ." + details. gitHash) : " "
40+ def preMarker = (details. commitDistance > 0 || ! details. isCleanTag) ? (" -beta." + details. commitDistance) : " "
41+ def versionString = " ${ baseVersion}${ preMarker} +mc${ minecraft_version}${ commitHashMarker}${ dirtyMarker} "
42+ version = versionString
3243 archivesBaseName = rootProject. archives_base_name + ' -' + project. name
3344
3445 sourceCompatibility = targetCompatibility = JavaVersion . VERSION_17
@@ -172,4 +183,4 @@ tasks.register('checkCleanTag') {
172183 throw new GradleException (' Not a clean tree.' )
173184 }
174185 }
175- }
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