diff --git a/README.md b/README.md index 6eee1d0d..49362c9e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Some fixes are based on prior work in various Forge PRs (check commit history an is directly derived from Sodium and used under the terms of the LGPL-3.0 license. ## Development builds (generally stable, but may occasionally have bugs) -- 1.16.5, both modloaders: https://nightly.link/embeddedt/ModernFix/workflows/gradle/main/Package.zip +- 1.16.5, both modloaders: https://nightly.link/embeddedt/ModernFix/workflows/gradle/1.16/Package.zip - 1.18.2, both modloaders: https://nightly.link/embeddedt/ModernFix/workflows/gradle/1.18/Package.zip - 1.19.2, both modloaders: https://nightly.link/embeddedt/ModernFix/workflows/gradle/1.19.2/Package.zip - 1.19.4, both modloaders: https://nightly.link/embeddedt/ModernFix/workflows/gradle/1.19.4/Package.zip diff --git a/build.gradle b/build.gradle index b1d00bf7..df933485 100644 --- a/build.gradle +++ b/build.gradle @@ -175,4 +175,4 @@ tasks.register('checkCleanTag') { throw new GradleException('Not a clean tree.') } } -} \ No newline at end of file +} diff --git a/common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/faster_texture_loading/TextureAtlasMixin.java b/common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/faster_texture_loading/TextureAtlasMixin.java index e986d88c..44b87a55 100644 --- a/common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/faster_texture_loading/TextureAtlasMixin.java +++ b/common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/faster_texture_loading/TextureAtlasMixin.java @@ -106,7 +106,7 @@ public abstract class TextureAtlasMixin { } @Inject(method = "load(Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite$Info;IIIII)Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;", - at = @At("HEAD"), cancellable = true) + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/texture/TextureAtlas;getResourceLocation(Lnet/minecraft/resources/ResourceLocation;)Lnet/minecraft/resources/ResourceLocation;"), cancellable = true) private void loadFromExisting(ResourceManager resourceManager, TextureAtlasSprite.Info spriteInfo, int storageX, int storageY, int mipLevel, int x, int y, CallbackInfoReturnable cir) { if(!usingFasterLoad) return; diff --git a/fabric/src/main/java/org/embeddedt/modernfix/fabric/mixin/perf/dynamic_resources/ModelBakeryMixin.java b/fabric/src/main/java/org/embeddedt/modernfix/fabric/mixin/perf/dynamic_resources/ModelBakeryMixin.java index e2f4717a..a2586ac1 100644 --- a/fabric/src/main/java/org/embeddedt/modernfix/fabric/mixin/perf/dynamic_resources/ModelBakeryMixin.java +++ b/fabric/src/main/java/org/embeddedt/modernfix/fabric/mixin/perf/dynamic_resources/ModelBakeryMixin.java @@ -303,7 +303,7 @@ public abstract class ModelBakeryMixin implements IExtendedModelBakery { }; // bake indigo models Stopwatch watch = Stopwatch.createStarted(); - this.topLevelModels.forEach((key, value) -> { + new ArrayList<>(this.topLevelModels.keySet()).forEach(key -> { try { this.bake(key, BlockModelRotation.X0_Y0); } catch(RuntimeException e) { diff --git a/forge/src/main/java/org/embeddedt/modernfix/forge/mixin/bugfix/ctm_resourceutil_cme/ResourceUtilMixin.java b/forge/src/main/java/org/embeddedt/modernfix/forge/mixin/bugfix/ctm_resourceutil_cme/ResourceUtilMixin.java new file mode 100644 index 00000000..7e5e41b2 --- /dev/null +++ b/forge/src/main/java/org/embeddedt/modernfix/forge/mixin/bugfix/ctm_resourceutil_cme/ResourceUtilMixin.java @@ -0,0 +1,35 @@ +package org.embeddedt.modernfix.forge.mixin.bugfix.ctm_resourceutil_cme; + +import org.embeddedt.modernfix.annotation.ClientOnlyMixin; +import org.embeddedt.modernfix.annotation.RequiresMod; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Mutable; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import team.chisel.ctm.client.util.ResourceUtil; + +import java.util.Collections; +import java.util.Map; +import java.util.concurrent.ConcurrentMap; + +@Mixin(ResourceUtil.class) +@RequiresMod("ctm") +@ClientOnlyMixin +@SuppressWarnings({"rawtypes", "unchecked"}) +public class ResourceUtilMixin { + @Shadow @Final @Mutable + private static Map metadataCache; + + /** + * @author embeddedt + * @reason quick fix to prevent rare CMEs + */ + @Inject(method = "", at = @At("RETURN")) + private static void synchronizeMetadataCache(CallbackInfo ci) { + if(!(metadataCache instanceof ConcurrentMap)) + metadataCache = Collections.synchronizedMap(metadataCache); + } +}