diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-10-22 22:39:04 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2022-10-22 22:39:04 +0800 |
| commit | 83b7f0488de9cc91951f4d9b2017f6ca1c0fa17e (patch) | |
| tree | db95f347f2e784c4adf17e7ce0acd9a1fe239f08 /fabric/src | |
| parent | 438d2387f330ffe8b328c4990498efa175b88a68 (diff) | |
| download | RoughlyEnoughItems-83b7f0488de9cc91951f4d9b2017f6ca1c0fa17e.tar.gz RoughlyEnoughItems-83b7f0488de9cc91951f4d9b2017f6ca1c0fa17e.tar.bz2 RoughlyEnoughItems-83b7f0488de9cc91951f4d9b2017f6ca1c0fa17e.zip | |
Support 22w42a
Diffstat (limited to 'fabric/src')
| -rw-r--r-- | fabric/src/main/java/me/shedaniel/rei/impl/client/fabric/CommandSenderImpl.java | 55 | ||||
| -rw-r--r-- | fabric/src/main/resources/error_notifier.json | 2 |
2 files changed, 1 insertions, 56 deletions
diff --git a/fabric/src/main/java/me/shedaniel/rei/impl/client/fabric/CommandSenderImpl.java b/fabric/src/main/java/me/shedaniel/rei/impl/client/fabric/CommandSenderImpl.java deleted file mode 100644 index 84212209e..000000000 --- a/fabric/src/main/java/me/shedaniel/rei/impl/client/fabric/CommandSenderImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.impl.client.fabric; - -import dev.architectury.platform.Platform; -import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -public class CommandSenderImpl { - public static void sendCommand(String command) { - LocalPlayer player = Minecraft.getInstance().player; - if (player == null) return; - String methodName = "method_44099"; - if (Platform.isDevelopmentEnvironment()) { - // 1.19.1 with boolean return - methodName = FabricLoader.getInstance().getMappingResolver().mapMethodName("intermediary", "net.minecraft.class_746", "method_44099", "(Ljava/lang/String;)Z"); - if (methodName.equals("method_44099")) { - // 1.19 with void return - methodName = FabricLoader.getInstance().getMappingResolver().mapMethodName("intermediary", "net.minecraft.class_746", "method_44099", "(Ljava/lang/String;)V"); - } - } - try { - Method declaredMethod = LocalPlayer.class.getDeclaredMethod(methodName, String.class); - if (declaredMethod != null) declaredMethod.setAccessible(true); - declaredMethod.invoke(player, command); - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); - } - } -} diff --git a/fabric/src/main/resources/error_notifier.json b/fabric/src/main/resources/error_notifier.json index eb85f6a7c..f6ba1b432 100644 --- a/fabric/src/main/resources/error_notifier.json +++ b/fabric/src/main/resources/error_notifier.json @@ -12,7 +12,7 @@ "type": "depends", "modId": "architectury", "modName": "Architectury API", - "versions": ">=5.0.0 <7.0.0", + "versions": ">=5.0.0 <8.0.0", "url": "https://www.curseforge.com/minecraft/mc-mods/architectury-api/files/all" }, { |
