From d7146a06674e3682f36dd6e7642e1f889f2f53b7 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Sat, 13 Jan 2024 11:14:59 -0500 Subject: [PATCH 1/3] Restrict resource pack cache to assets/ and data/ folders --- .../mixin/perf/resourcepacks/ModNioResourcePackMixin.java | 2 +- .../mixin/perf/resourcepacks/ModFileResourcePackMixin.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fabric/src/main/java/org/embeddedt/modernfix/fabric/mixin/perf/resourcepacks/ModNioResourcePackMixin.java b/fabric/src/main/java/org/embeddedt/modernfix/fabric/mixin/perf/resourcepacks/ModNioResourcePackMixin.java index 40358925..93356848 100644 --- a/fabric/src/main/java/org/embeddedt/modernfix/fabric/mixin/perf/resourcepacks/ModNioResourcePackMixin.java +++ b/fabric/src/main/java/org/embeddedt/modernfix/fabric/mixin/perf/resourcepacks/ModNioResourcePackMixin.java @@ -58,7 +58,7 @@ public abstract class ModNioResourcePackMixin implements ICachingResourcePack { @Inject(method = "hasResource", at = @At(value = "INVOKE", target = "Lnet/fabricmc/fabric/impl/resource/loader/ModNioResourcePack;getPath(Ljava/lang/String;)Ljava/nio/file/Path;"), cancellable = true) private void useCacheForExistence(String path, CallbackInfoReturnable cir) { - if(cacheEngine != null) + if(cacheEngine != null && (path.startsWith("assets/") || path.startsWith("data/"))) cir.setReturnValue(this.cacheEngine.hasResource(path)); } } diff --git a/forge/src/main/java/org/embeddedt/modernfix/forge/mixin/perf/resourcepacks/ModFileResourcePackMixin.java b/forge/src/main/java/org/embeddedt/modernfix/forge/mixin/perf/resourcepacks/ModFileResourcePackMixin.java index 55173bc5..c3e4c03c 100644 --- a/forge/src/main/java/org/embeddedt/modernfix/forge/mixin/perf/resourcepacks/ModFileResourcePackMixin.java +++ b/forge/src/main/java/org/embeddedt/modernfix/forge/mixin/perf/resourcepacks/ModFileResourcePackMixin.java @@ -56,7 +56,7 @@ public abstract class ModFileResourcePackMixin implements ICachingResourcePack { @Inject(method = "hasResource(Ljava/lang/String;)Z", at = @At(value = "HEAD"), cancellable = true) private void useCacheForExistence(String path, CallbackInfoReturnable cir) { - if(cacheEngine != null) + if(cacheEngine != null && (path.startsWith("assets/") || path.startsWith("data/"))) cir.setReturnValue(this.cacheEngine.hasResource(path)); } From 94ca6ccdd6832f4b4436405d183b57349a97aeff Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Thu, 18 Jan 2024 16:14:37 -0500 Subject: [PATCH 2/3] Add bug report template, heavily derived from Sodium --- .github/ISSUE_TEMPLATE/bug_report.yml | 54 +++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 6 +++ 2 files changed, 60 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000..113b6525 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,54 @@ +name: Bug Report +description: "For reporting bugs and other defects" +body: + - type: markdown + attributes: + value: >- + **Note: This issue tracker is not intended for support requests!** If you need help with crashes or other issues, then + you should [ask on our Discord server](https://discord.gg/rN9Y7caguP) instead. Unless you are certain that you + have found a defect, and you are able to point to where the problem is, you should not open an issue. +

+ Additionally, please make sure you have done the following: + + - **Have you ensured that all of your mods (including ModernFix) are up-to-date?** The latest version of ModernFix + can always be found [on Modrinth](https://modrinth.com/mod/modernfix). + + - **Have you used the [search tool](https://github.com/embeddedt/ModernFix/issues) to check whether your issue + has already been reported?** If it has been, then consider adding more information to the existing issue instead. + + - **Have you determined the minimum set of instructions to reproduce the issue?** If your problem only occurs + with other mods installed, then you should narrow down exactly which mods are causing the issue. Please do not + provide your entire list of mods to us and expect that we will be able to figure out the problem. + - type: textarea + id: description + attributes: + label: Bug Description + description: >- + Use this section to describe the issue you are experiencing in as much depth as possible. The description should + explain what behavior you were expecting, and why you believe the issue to be a bug. If the issue you are reporting + only occurs with specific mods installed, then provide the name and version of each mod. + + **Hint:** If you have any screenshots, videos, or other information that you feel is necessary to + explain the issue, you can attach them here. + - type: textarea + id: description-reproduction-steps + attributes: + label: Reproduction Steps + description: >- + Provide as much information as possible on how to reproduce this bug. Make sure your instructions are as clear and + concise as possible, because other people will need to be able to follow your guide in order to re-create the issue. + + **Hint:** A common way to fill this section out is to write a step-by-step guide. + validations: + required: true + - type: textarea + id: log-file + attributes: + label: Log File + description: >- + **Hint:** You can usually find the log files within the folder `.minecraft/logs`. Most often, you will want the `latest.log` + file, since that file belongs to the last played session of the game. + placeholder: >- + Drag-and-drop the log file here. + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..2354f98d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,6 @@ +blank_issues_enabled: true +contact_links: + - name: For help with other issues, join our Discord community + url: https://discord.gg/rN9Y7caguP + about: This is the best option for getting help with mod installation, performance issues, and any other support inquiries + # Copied from https://github.com/CaffeineMC/sodium-fabric#community From c749fc1aeb22898a400d2f2829a86098d0a1b0cd Mon Sep 17 00:00:00 2001 From: Fury_Phoenix <64714532+Phoenix-Starlight@users.noreply.github.com> Date: Thu, 25 Jan 2024 12:19:37 -0800 Subject: [PATCH 3/3] Tidy up version detection (#352) --- .../platform/fabric/ModernFixPlatformHooksImpl.java | 8 +++----- .../platform/forge/ModernFixPlatformHooksImpl.java | 13 +++---------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/fabric/src/main/java/org/embeddedt/modernfix/platform/fabric/ModernFixPlatformHooksImpl.java b/fabric/src/main/java/org/embeddedt/modernfix/platform/fabric/ModernFixPlatformHooksImpl.java index c7a51e0f..fafe752a 100644 --- a/fabric/src/main/java/org/embeddedt/modernfix/platform/fabric/ModernFixPlatformHooksImpl.java +++ b/fabric/src/main/java/org/embeddedt/modernfix/platform/fabric/ModernFixPlatformHooksImpl.java @@ -38,13 +38,11 @@ public class ModernFixPlatformHooksImpl implements ModernFixPlatformHooks { return FabricLoader.getInstance().getEnvironmentType() == EnvType.SERVER; } - private static String verString; + private static final String verString = FabricLoader.getInstance().getModContainer("modernfix") + .map(mfModContainer -> mfModContainer.getMetadata().getVersion().getFriendlyString()) + .orElse("[unknown]"); public String getVersionString() { - if(verString == null) { - ModContainer mfModContainer = FabricLoader.getInstance().getModContainer("modernfix").get(); - verString = mfModContainer.getMetadata().getVersion().getFriendlyString(); - } return verString; } diff --git a/forge/src/main/java/org/embeddedt/modernfix/platform/forge/ModernFixPlatformHooksImpl.java b/forge/src/main/java/org/embeddedt/modernfix/platform/forge/ModernFixPlatformHooksImpl.java index fb896bf5..25aa714c 100644 --- a/forge/src/main/java/org/embeddedt/modernfix/platform/forge/ModernFixPlatformHooksImpl.java +++ b/forge/src/main/java/org/embeddedt/modernfix/platform/forge/ModernFixPlatformHooksImpl.java @@ -54,7 +54,6 @@ import java.net.URLClassLoader; import java.nio.file.Path; import java.util.Enumeration; import java.util.Map; -import java.util.Objects; import java.util.Optional; import java.util.function.Consumer; import java.util.function.Function; @@ -68,17 +67,11 @@ public class ModernFixPlatformHooksImpl implements ModernFixPlatformHooks { return FMLLoader.getDist().isDedicatedServer(); } - private static String verString; + private static final String verString = Optional.ofNullable( + ModernFixMixinPlugin.class.getPackage().getImplementationVersion()) + .orElse("[unknown]"); public String getVersionString() { - if(verString == null) { - try { - verString = ModernFixMixinPlugin.class.getPackage().getImplementationVersion(); - Objects.requireNonNull(verString); - } catch(Throwable e) { - verString = "[unknown]"; - } - } return verString; }