aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/firmament/mixins/BandAidResourcePackPatch.java
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-03-14 18:58:22 +0100
committerLinnea Gräf <nea@nea.moe>2024-03-14 18:58:22 +0100
commit4bf53dcaf18dcc1fb7b064f482b2e8922d9d326f (patch)
treef163e9f9a58eaa5000da4cfa23ccc7e54f231dc5 /src/main/java/moe/nea/firmament/mixins/BandAidResourcePackPatch.java
parentb025b06b6b799b16cfcfb26ee8ffad27879a1bfb (diff)
downloadfirmament-4bf53dcaf18dcc1fb7b064f482b2e8922d9d326f.tar.gz
firmament-4bf53dcaf18dcc1fb7b064f482b2e8922d9d326f.tar.bz2
firmament-4bf53dcaf18dcc1fb7b064f482b2e8922d9d326f.zip
Bandaid fix resources not being loade for june
[no changelog]
Diffstat (limited to 'src/main/java/moe/nea/firmament/mixins/BandAidResourcePackPatch.java')
-rw-r--r--src/main/java/moe/nea/firmament/mixins/BandAidResourcePackPatch.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/BandAidResourcePackPatch.java b/src/main/java/moe/nea/firmament/mixins/BandAidResourcePackPatch.java
new file mode 100644
index 0000000..3100dbe
--- /dev/null
+++ b/src/main/java/moe/nea/firmament/mixins/BandAidResourcePackPatch.java
@@ -0,0 +1,30 @@
+/*
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+package moe.nea.firmament.mixins;
+
+import com.llamalad7.mixinextras.injector.ModifyReturnValue;
+import com.llamalad7.mixinextras.sugar.Local;
+import moe.nea.firmament.repo.RepoModResourcePack;
+import net.minecraft.resource.ReloadableResourceManagerImpl;
+import net.minecraft.resource.Resource;
+import net.minecraft.util.Identifier;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+
+import java.util.Optional;
+
+@Mixin(ReloadableResourceManagerImpl.class)
+public class BandAidResourcePackPatch {
+
+ @ModifyReturnValue(
+ method = "getResource",
+ at = @At("RETURN")
+ )
+ private Optional<Resource> injectOurCustomResourcesInCaseExistingMethodsFailed(Optional<Resource> original, @Local Identifier identifier) {
+ return original.or(() -> RepoModResourcePack.Companion.createResourceDirectly(identifier));
+ }
+}