aboutsummaryrefslogtreecommitdiff
path: root/forge
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2021-08-28 04:27:25 +0800
committershedaniel <daniel@shedaniel.me>2021-08-28 16:12:05 +0800
commit88472ebfdce663fb3cbc5448cfa1137358ed9b16 (patch)
tree1f0220f9df63c3cc4006320d4f1e73bedab8326b /forge
parent8a0601c75fa2462494ed949797f04243fe9cb10e (diff)
downloadRoughlyEnoughItems-88472ebfdce663fb3cbc5448cfa1137358ed9b16.tar.gz
RoughlyEnoughItems-88472ebfdce663fb3cbc5448cfa1137358ed9b16.tar.bz2
RoughlyEnoughItems-88472ebfdce663fb3cbc5448cfa1137358ed9b16.zip
Fix #500
Diffstat (limited to 'forge')
-rw-r--r--forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java2
-rw-r--r--forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplImpl.java8
2 files changed, 9 insertions, 1 deletions
diff --git a/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java b/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java
index 8ee7a0a99..98d16516c 100644
--- a/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java
+++ b/forge/src/main/java/me/shedaniel/rei/forge/PluginDetectorImpl.java
@@ -31,6 +31,7 @@ import me.shedaniel.rei.api.common.plugins.REIPluginProvider;
import me.shedaniel.rei.api.common.plugins.REIServerPlugin;
import me.shedaniel.rei.impl.ClientInternals;
import me.shedaniel.rei.jeicompat.JEIPluginDetector;
+import me.shedaniel.rei.jeicompat.JEITransferHandlerPlugin;
import me.shedaniel.rei.plugin.client.DefaultClientPlugin;
import me.shedaniel.rei.plugin.client.runtime.DefaultClientRuntimePlugin;
import me.shedaniel.rei.plugin.common.DefaultPlugin;
@@ -71,6 +72,7 @@ public class PluginDetectorImpl {
public static void detectServerPlugins() {
PluginView.getServerInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultPlugin()));
PluginView.getServerInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new DefaultRuntimePlugin()));
+ PluginView.getServerInstance().registerPlugin(wrapPlugin(Collections.singletonList("roughlyenoughitems"), new JEITransferHandlerPlugin()));
RoughlyEnoughItemsForge.<REIPlugin, REIServerPlugin>scanAnnotation(REIPlugin.class, REIServerPlugin.class::isAssignableFrom, (modId, plugin) -> {
((PluginView<REIServerPlugin>) PluginManager.getServerInstance()).registerPlugin(wrapPlugin(modId, plugin.get()));
});
diff --git a/forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplImpl.java b/forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplImpl.java
index 1b27ecf80..90b0e8857 100644
--- a/forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplImpl.java
+++ b/forge/src/main/java/me/shedaniel/rei/impl/client/gui/forge/ScreenOverlayImplImpl.java
@@ -26,11 +26,16 @@ package me.shedaniel.rei.impl.client.gui.forge;
import com.mojang.blaze3d.vertex.PoseStack;
import me.shedaniel.rei.api.client.gui.widgets.Tooltip;
import me.shedaniel.rei.api.common.entry.EntryStack;
+import me.shedaniel.rei.api.common.util.CollectionUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
+import net.minecraft.network.chat.FormattedText;
+import net.minecraft.network.chat.Style;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.fmlclient.gui.GuiUtils;
+import java.util.List;
+
public class ScreenOverlayImplImpl {
public static void renderTooltipInner(Screen screen, PoseStack matrices, Tooltip tooltip, int mouseX, int mouseY) {
matrices.pushPose();
@@ -38,7 +43,8 @@ public class ScreenOverlayImplImpl {
EntryStack<?> stack = tooltip.getContextStack();
ItemStack itemStack = stack.getValue() instanceof ItemStack ? stack.castValue() : ItemStack.EMPTY;
GuiUtils.preItemToolTip(itemStack);
- GuiUtils.drawHoveringText(matrices, tooltip.getText(), mouseX, mouseY, screen.width, screen.height, screen.width, Minecraft.getInstance().font);
+ List<FormattedText> texts = CollectionUtils.flatMap(tooltip.getText(), component -> Minecraft.getInstance().font.getSplitter().splitLines(component, 100000, Style.EMPTY));
+ GuiUtils.drawHoveringText(matrices, texts, mouseX, mouseY, screen.width, screen.height, screen.width, Minecraft.getInstance().font);
GuiUtils.postItemToolTip();
matrices.popPose();
}