Add an option to disable Caxton on macOS (or other specified OS)

Environment

  • Caxton version: 0.5.6+1.20.4-fabric
  • Minecraft version: 1.20.4
  • Mod loader and version: Fabric Loader 0.15.9, Fabric API 0.97.0+1.20.4
  • Operating system and CPU architecture: Apple M1 (macOS)

Summary

A user of my modpack reported that the game froze during loading on Mac. It appears to be related to the wrong Caxton version (using the WIN/Linux version on macOS). Once the fontpack was removed, the game would launch.

🤔So, is it possible to add an option to disable Caxton on a specified OS? For instance, Mac users may use a modpack containing Caxton. In MOST situations, modpack developers are unable to provide an extra version for Mac, which could limit the modpack's accessibility.

Steps to reproduce

Used fontpack: https://modrinth.com/resourcepack/xplus-font-pack/version/1.1.0

Expected behavior: N/A

Actual behavior: The game froze during the loading process.

Relevant logs and/or screenshots

[18:58:32] [Render thread/ERROR]: Caught error loading resourcepacks!
java.util.concurrent.CompletionException: java.lang.UnsatisfiedLinkError: 'long xyz.flirora.caxton.dll.CaxtonInternal.createFont(java.nio.ByteBuffer, java.lang.String, java.lang.String)'
	at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) ~[?:?]
	at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) ~[?:?]
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770) ~[?:?]
	at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) ~[?:?]
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387) ~[?:?]
	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312) ~[?:?]
	at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843) ~[?:?]
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808) ~[?:?]
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188) ~[?:?]
Caused by: java.lang.UnsatisfiedLinkError: 'long xyz.flirora.caxton.dll.CaxtonInternal.createFont(java.nio.ByteBuffer, java.lang.String, java.lang.String)'
	at xyz.flirora.caxton.dll.CaxtonInternal.createFont(Native Method) ~[caxton-0.5.6+1.20.4-FABRIC.jar:?]
	at xyz.flirora.caxton.font.CaxtonFont.<init>(CaxtonFont.java:77) ~[caxton-0.5.6+1.20.4-FABRIC.jar:?]
	at xyz.flirora.caxton.font.CaxtonFontLoader.lambda$loadFontByIdentifier$7(CaxtonFontLoader.java:102) ~[caxton-0.5.6+1.20.4-FABRIC.jar:?]
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708) ~[?:?]
	at xyz.flirora.caxton.font.CaxtonFontLoader.loadFontByIdentifier(CaxtonFontLoader.java:85) ~[caxton-0.5.6+1.20.4-FABRIC.jar:?]
	at xyz.flirora.caxton.font.ConfiguredCaxtonFont.load(ConfiguredCaxtonFont.java:50) ~[caxton-0.5.6+1.20.4-FABRIC.jar:?]
	at xyz.flirora.caxton.font.CaxtonFontLoader.load(CaxtonFontLoader.java:143) ~[caxton-0.5.6+1.20.4-FABRIC.jar:?]
	at net.minecraft.class_378.method_51616(class_378.java:194) ~[client-intermediary.jar:?]
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
	... 6 more
Edited by Wudji