diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-10-21 23:48:30 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2022-10-21 23:48:30 +0800 |
| commit | 22e1bf58aeb4204bed30200b28da60284f384f88 (patch) | |
| tree | fe84b955a8f3469dda08a2f636818c955a5c459e /fabric/src/main/java/me | |
| parent | d70b8353a6db5fc5d835af5d662372952703d2fd (diff) | |
| parent | d8c250d378a2cbaede41093a80973e47f34aec00 (diff) | |
| download | RoughlyEnoughItems-22e1bf58aeb4204bed30200b28da60284f384f88.tar.gz RoughlyEnoughItems-22e1bf58aeb4204bed30200b28da60284f384f88.tar.bz2 RoughlyEnoughItems-22e1bf58aeb4204bed30200b28da60284f384f88.zip | |
Merge remote-tracking branch 'origin/8.x-1.18.2' into modularity
# Conflicts:
# api/build.gradle
# default-plugin/build.gradle
# forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java
# runtime-frontend/overlay-entries/src/main/java/me/shedaniel/rei/impl/client/gui/overlay/entries/EntryListStackEntry.java
# runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/AbstractDisplayViewingScreen.java
# runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/CompositeDisplayViewingScreen.java
# runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java
# runtime/src/main/java/me/shedaniel/rei/impl/client/gui/widget/InternalWidgets.java
Diffstat (limited to 'fabric/src/main/java/me')
| -rw-r--r-- | fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinInputConstants.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinInputConstants.java b/fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinInputConstants.java new file mode 100644 index 000000000..634c81339 --- /dev/null +++ b/fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinInputConstants.java @@ -0,0 +1,52 @@ +/* + * 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.fabric; + +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() { + try { + return ConfigObject.getInstance().isPatchingAsyncThreadCrash(); + } catch (Throwable throwable) { + return false; + } + } +} |
