diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-09-18 02:20:25 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2022-09-18 02:21:27 +0800 |
| commit | 4211f1fb193825307ffa7b8970a987b8f441efb0 (patch) | |
| tree | 2e76fe93b3fc6de947541360ba2fe5b2eb82daf3 /forge | |
| parent | 47896cdd0e1d440ca85aef3cc8f24b229a18c949 (diff) | |
| download | RoughlyEnoughItems-4211f1fb193825307ffa7b8970a987b8f441efb0.tar.gz RoughlyEnoughItems-4211f1fb193825307ffa7b8970a987b8f441efb0.tar.bz2 RoughlyEnoughItems-4211f1fb193825307ffa7b8970a987b8f441efb0.zip | |
Fix #1034
Diffstat (limited to 'forge')
| -rw-r--r-- | forge/build.gradle | 9 | ||||
| -rw-r--r-- | forge/src/main/java/me/shedaniel/rei/mixin/forge/MixinInputConstants.java | 48 | ||||
| -rw-r--r-- | forge/src/main/resources/rei.mixins.json | 1 |
3 files changed, 49 insertions, 9 deletions
diff --git a/forge/build.gradle b/forge/build.gradle index 37cf85e1f..b62ac7829 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -56,13 +56,6 @@ loom { } forge { - localMods { - jeiInternalsWorkaround { - add(project(":jei-compatibility-layer").sourceSets.main) - add(project(":jei-internals-workaround").sourceSets.main) - } - } - mixinConfig "rei.mixins.json" } } @@ -74,8 +67,6 @@ dependencies { modApi("me.shedaniel.cloth:cloth-config-forge:${cloth_config_version}") modApi("dev.architectury:architectury-forge:${architectury_version}") - runtimeClasspath(project(path: ":jei-internals-workaround", configuration: "namedElements")) { transitive false } - depProjects.forEach { common(project(path: it, configuration: "namedElements")) { transitive false } shadowCommon(project(path: it, configuration: "transformProductionForge")) { transitive false } 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(); + } +} diff --git a/forge/src/main/resources/rei.mixins.json b/forge/src/main/resources/rei.mixins.json index 1eabc9229..d729d79f9 100644 --- a/forge/src/main/resources/rei.mixins.json +++ b/forge/src/main/resources/rei.mixins.json @@ -5,6 +5,7 @@ "client": [ "MixinClientPacketListener", "MixinEffectRenderingInventoryScreen", + "MixinInputConstants", "MixinRecipeToast" ], "mixins": [ |
