aboutsummaryrefslogtreecommitdiff
path: root/forge/src/main/java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2022-09-18 02:20:25 +0800
committershedaniel <daniel@shedaniel.me>2023-05-29 21:16:06 +0800
commit020d346c461a213814e655d53d64be875169f0d5 (patch)
tree7f1665aaecceed51619ffcf655ceabca355ba94d /forge/src/main/java
parent4a54460ba8b09826f781e63234d706f85c766fba (diff)
downloadRoughlyEnoughItems-020d346c461a213814e655d53d64be875169f0d5.tar.gz
RoughlyEnoughItems-020d346c461a213814e655d53d64be875169f0d5.tar.bz2
RoughlyEnoughItems-020d346c461a213814e655d53d64be875169f0d5.zip
Fix #1034
Diffstat (limited to 'forge/src/main/java')
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java2
-rw-r--r--forge/src/main/java/me/shedaniel/rei/mixin/forge/MixinInputConstants.java48
2 files changed, 48 insertions, 2 deletions
diff --git a/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java b/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java
index db26e74c3..8b9908313 100644
--- a/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java
+++ b/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java
@@ -40,7 +40,6 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -94,7 +93,6 @@ public class PluginDetectorImpl implements PluginDetector {
AnnotationUtils.<REIPlugin, REIClientPlugin>scanAnnotation(REIPlugin.class, REIClientPlugin.class::isAssignableFrom, (modId, plugin, clazz) -> {
((PluginView<REIClientPlugin>) PluginManager.getClientInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
});
- ClientInternals.attachInstance((Supplier<List<String>>) ArrayList::new, "jeiCompatMods");
};
}
}
diff --git a/forge/src/main/java/me/shedaniel/rei/mixin/forge/MixinInputConstants.java b/forge/src/main/java/me/shedaniel/rei/mixin/forge/MixinInputConstants.java
new file mode 100644
index 000000000..7d6b31a65
--- /dev/null
+++ b/forge/src/main/java/me/shedaniel/rei/mixin/forge/MixinInputConstants.java
@@ -0,0 +1,48 @@
+/*
+ * This file is licensed under the MIT License, part of Roughly Enough Items.
+ * Copyright (c) 2018, 2019, 2020, 2021, 2022 shedaniel
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package me.shedaniel.rei.mixin.forge;
+
+import com.mojang.blaze3d.platform.InputConstants;
+import com.mojang.blaze3d.systems.RenderSystem;
+import me.shedaniel.rei.api.client.config.ConfigObject;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Unique;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+@Mixin(InputConstants.class)
+public class MixinInputConstants {
+ @Inject(method = "isKeyDown", at = @At("HEAD"), cancellable = true)
+ private static void isKeyDown(long windowId, int key, CallbackInfoReturnable<Boolean> cir) {
+ if (isPatchingAsyncThreadCrash() && !RenderSystem.isOnRenderThread()) {
+ cir.setReturnValue(false);
+ }
+ }
+
+ @Unique
+ private static boolean isPatchingAsyncThreadCrash() {
+ return ConfigObject.getInstance().isPatchingAsyncThreadCrash();
+ }
+}