From becefcce17a7130bb5642fc4cbf3ad4f7cbdcadf Mon Sep 17 00:00:00 2001 From: shedaniel Date: Sat, 22 Oct 2022 22:40:44 +0800 Subject: Remove useless class --- .../rei/impl/client/forge/CommandSenderImpl.java | 60 ---------------------- 1 file changed, 60 deletions(-) delete mode 100644 forge/src/main/java/me/shedaniel/rei/impl/client/forge/CommandSenderImpl.java (limited to 'forge/src/main') diff --git a/forge/src/main/java/me/shedaniel/rei/impl/client/forge/CommandSenderImpl.java b/forge/src/main/java/me/shedaniel/rei/impl/client/forge/CommandSenderImpl.java deleted file mode 100644 index 83253fc9c..000000000 --- a/forge/src/main/java/me/shedaniel/rei/impl/client/forge/CommandSenderImpl.java +++ /dev/null @@ -1,60 +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.forge; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.player.LocalPlayer; -import net.minecraftforge.fml.util.ObfuscationReflectionHelper; - -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; - Method method = null; - try { - // 1.19 - method = ObfuscationReflectionHelper.findMethod(LocalPlayer.class, "m_234156_", String.class); - } catch (ObfuscationReflectionHelper.UnableToFindMethodException ignored) { - } - if (method == null) { - try { - // 1.19.1 - method = ObfuscationReflectionHelper.findMethod(LocalPlayer.class, "m_242614_", String.class); - } catch (ObfuscationReflectionHelper.UnableToFindMethodException ignored) { - } - } - if (method == null) { - throw new RuntimeException("Unable to find method"); - } - - try { - method.invoke(player, command); - } catch (IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); - } - } -} -- cgit