diff options
Diffstat (limited to 'forge/src/main/java')
3 files changed, 4 insertions, 62 deletions
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 7916f8adc..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, 2023 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); - } - } -} diff --git a/forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplForge.java b/forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplForge.java index ab013f179..832bd0b1d 100644 --- a/forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplForge.java +++ b/forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplForge.java @@ -31,6 +31,7 @@ import me.shedaniel.rei.api.common.util.CollectionUtils; import me.shedaniel.rei.impl.client.gui.ScreenOverlayImpl; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; +import net.minecraft.client.gui.screens.inventory.tooltip.DefaultTooltipPositioner; import net.minecraft.network.chat.Component; import net.minecraft.world.inventory.tooltip.TooltipComponent; import net.minecraft.world.item.ItemStack; @@ -61,7 +62,7 @@ public class ScreenOverlayImplForge extends ScreenOverlayImpl { } } screen.tooltipStack = itemStack; - screen.renderTooltipInternal(matrices, components, mouseX, mouseY); + screen.renderTooltipInternal(matrices, components, mouseX, mouseY, DefaultTooltipPositioner.INSTANCE); screen.tooltipStack = ItemStack.EMPTY; matrices.popPose(); } diff --git a/forge/src/main/java/me/shedaniel/rei/mixin/forge/MixinTagLoader.java b/forge/src/main/java/me/shedaniel/rei/mixin/forge/MixinTagLoader.java index 2f066b6ca..43a5b95c2 100644 --- a/forge/src/main/java/me/shedaniel/rei/mixin/forge/MixinTagLoader.java +++ b/forge/src/main/java/me/shedaniel/rei/mixin/forge/MixinTagLoader.java @@ -32,6 +32,7 @@ import me.shedaniel.rei.api.common.util.CollectionUtils; import me.shedaniel.rei.impl.common.InternalLogger; import me.shedaniel.rei.plugin.common.displays.tag.TagNodes; import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagEntry; @@ -66,7 +67,7 @@ public class MixinTagLoader<T> { TagNodes.TAG_DATA_MAP.put(resourceKey, new HashMap<>()); Map<ResourceLocation, TagNodes.TagData> tagDataMap = TagNodes.TAG_DATA_MAP.get(resourceKey); if (tagDataMap == null) return; - Registry<T> registry = ((Registry<Registry<T>>) Registry.REGISTRY).get((ResourceKey<Registry<T>>) resourceKey); + Registry<T> registry = ((Registry<Registry<T>>) BuiltInRegistries.REGISTRY).get((ResourceKey<Registry<T>>) resourceKey); Stopwatch stopwatch = Stopwatch.createStarted(); Iterator<Map.Entry<TagNodes.CollectionWrapper<?>, TagNodes.RawTagData>> entryIterator = TagNodes.RAW_TAG_DATA_MAP.getOrDefault(directory, Reference2ObjectMaps.emptyMap()) |
