diff --git a/src/main/java/mcp/mobius/waila/access/ClientAccessor.java b/src/main/java/mcp/mobius/waila/access/ClientAccessor.java index f7b2f242..a67a4625 100644 --- a/src/main/java/mcp/mobius/waila/access/ClientAccessor.java +++ b/src/main/java/mcp/mobius/waila/access/ClientAccessor.java @@ -4,7 +4,6 @@ import mcp.mobius.waila.api.ICommonAccessor; import mcp.mobius.waila.api.IDataReader; import mcp.mobius.waila.api.IEntityAccessor; -import mcp.mobius.waila.api.IPluginInfo; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.registries.BuiltInRegistries; @@ -46,22 +45,6 @@ public enum ClientAccessor implements ICommonAccessor, IBlockAccessor, IEntityAc private double rayCastMaxDistance; private float frameTime; - private @Nullable IPluginInfo plugin; - private @Nullable Class provider; - - public void setOrigin(@Nullable IPluginInfo plugin, @Nullable Class provider) { - this.plugin = plugin; - this.provider = provider; - } - - public @Nullable IPluginInfo getPlugin() { - return plugin; - } - - public @Nullable Class getProvider() { - return provider; - } - @Override public Level getWorld() { return this.world; diff --git a/src/main/java/mcp/mobius/waila/command/ClientCommand.java b/src/main/java/mcp/mobius/waila/command/ClientCommand.java index 1874e424..d5629d96 100644 --- a/src/main/java/mcp/mobius/waila/command/ClientCommand.java +++ b/src/main/java/mcp/mobius/waila/command/ClientCommand.java @@ -161,7 +161,8 @@ protected final void register(ArgumentBuilderBuilder command) { .then(literal("inspect")) .executes(context -> { - Minecraft.getInstance().schedule(InspectorScreen::open); + var client = Minecraft.getInstance(); + client.schedule(() -> client.setScreen(new InspectorScreen())); return 1; }) .pop("inspect") diff --git a/src/main/java/mcp/mobius/waila/gui/hud/ComponentHandler.java b/src/main/java/mcp/mobius/waila/gui/hud/ComponentHandler.java index 46dd697e..70e84e51 100644 --- a/src/main/java/mcp/mobius/waila/gui/hud/ComponentHandler.java +++ b/src/main/java/mcp/mobius/waila/gui/hud/ComponentHandler.java @@ -1,6 +1,7 @@ package mcp.mobius.waila.gui.hud; import java.util.Objects; +import java.util.function.Function; import lol.bai.badpackets.api.PacketSender; import mcp.mobius.waila.Waila; @@ -13,6 +14,7 @@ import mcp.mobius.waila.config.PluginConfig; import mcp.mobius.waila.network.play.c2s.BlockDataRequestPlayC2SPacket; import mcp.mobius.waila.network.play.c2s.EntityDataRequestPlayC2SPacket; +import mcp.mobius.waila.registry.PluginAware; import mcp.mobius.waila.registry.Registrar; import mcp.mobius.waila.util.ExceptionUtil; import net.minecraft.client.Minecraft; @@ -25,6 +27,8 @@ public class ComponentHandler { + public static @Nullable Function, Line.Wrapper> wrapperFactory; + public static void requestBlockData(ClientAccessor accessor) { var registrar = Registrar.get(); var block = accessor.getBlock(); @@ -68,7 +72,7 @@ private static void handleBlock(ClientAccessor accessor, Tooltip tooltip, Object for (var entry : providers) { var pa = entry.instance(); var provider = pa.instance(); - accessor.setOrigin(pa.origin(), provider.getClass()); + if (wrapperFactory != null) tooltip.wrapper = wrapperFactory.apply(pa); try { switch (position) { case HEAD -> provider.appendHead(tooltip, accessor, PluginConfig.CLIENT); @@ -78,7 +82,7 @@ private static void handleBlock(ClientAccessor accessor, Tooltip tooltip, Object } catch (Throwable e) { ExceptionUtil.dump(e, provider.getClass().toString(), tooltip); } - accessor.setOrigin(null, null); + if (wrapperFactory != null) tooltip.wrapper = null; } } @@ -113,7 +117,7 @@ public static void gatherEntity(Entity entity, ClientAccessor accessor, Tooltip for (var entry : providers) { var pa = entry.instance(); var provider = pa.instance(); - accessor.setOrigin(pa.origin(), provider.getClass()); + if (wrapperFactory != null) tooltip.wrapper = wrapperFactory.apply(pa); try { switch (position) { case HEAD -> provider.appendHead(tooltip, accessor, PluginConfig.CLIENT); @@ -123,7 +127,7 @@ public static void gatherEntity(Entity entity, ClientAccessor accessor, Tooltip } catch (Throwable e) { ExceptionUtil.dump(e, provider.getClass().toString(), tooltip); } - accessor.setOrigin(null, null); + if (wrapperFactory != null) tooltip.wrapper = null; } } @@ -138,6 +142,7 @@ public static ITooltipComponent getIcon(HitResult target) { var pa = provider.instance(); var icon = pa.instance().getIcon(data, config); if (icon != null) { + if (wrapperFactory != null) icon = wrapperFactory.apply(pa).wrap(null, icon); return icon; } } @@ -152,6 +157,7 @@ public static ITooltipComponent getIcon(HitResult target) { var pa = provider.instance(); var icon = pa.instance().getIcon(ClientAccessor.INSTANCE, PluginConfig.CLIENT); if (icon != null) { + if (wrapperFactory != null) icon = wrapperFactory.apply(pa).wrap(null, icon); result = icon; priority = provider.priority(); break; @@ -166,6 +172,7 @@ public static ITooltipComponent getIcon(HitResult target) { var pa = provider.instance(); var icon = pa.instance().getIcon(ClientAccessor.INSTANCE, PluginConfig.CLIENT); if (icon != null) { + if (wrapperFactory != null) icon = wrapperFactory.apply(pa).wrap(null, icon); result = icon; break; } diff --git a/src/main/java/mcp/mobius/waila/gui/hud/ComponentRenderer.java b/src/main/java/mcp/mobius/waila/gui/hud/ComponentRenderer.java index 31148ef8..310aaca9 100644 --- a/src/main/java/mcp/mobius/waila/gui/hud/ComponentRenderer.java +++ b/src/main/java/mcp/mobius/waila/gui/hud/ComponentRenderer.java @@ -11,17 +11,40 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.RenderType; import net.minecraft.util.Mth; +import org.jetbrains.annotations.Nullable; -public interface ComponentRenderer { +public abstract class ComponentRenderer { - Random RANDOM = new Random(); + private static final Random RANDOM = new Random(); - void render(GuiGraphics ctx, ITooltipComponent component, int x, int y, int cw, int ch, DeltaTracker delta); + public abstract void render(GuiGraphics ctx, ITooltipComponent component, int x, int y, int cw, int ch, DeltaTracker delta); - ComponentRenderer DEFAULT = (ctx, component, x, y, cw, ch, delta) -> { - component.render(ctx, x, y, delta); + private static @Nullable ComponentRenderer current = null; - if (WailaClient.showComponentBounds) { + public static ComponentRenderer get() { + if (current == null) current = Default.INSTANCE; + return current; + } + + public static void set(@Nullable ComponentRenderer value) { + if (value == null) value = Default.INSTANCE; + current = value; + } + + public static class Default extends ComponentRenderer { + + public static final Default INSTANCE = new Default(); + + @Override + public void render(GuiGraphics ctx, ITooltipComponent component, int x, int y, int cw, int ch, DeltaTracker delta) { + component.render(ctx, x, y, delta); + + if (WailaClient.showComponentBounds) { + renderBounds(ctx, x, y, cw, ch, 1f); + } + } + + public static void renderBounds(GuiGraphics ctx, int x, int y, int cw, int ch, float v) { ctx.pose().pushPose(); var scale = (float) Minecraft.getInstance().getWindow().getGuiScale(); ctx.pose().scale(1 / scale, 1 / scale, 1); @@ -31,12 +54,13 @@ public interface ComponentRenderer { var by = Mth.floor(y * scale + 0.5); var bw = Mth.floor(cw * scale + 0.5); var bh = Mth.floor(ch * scale + 0.5); - var color = (0xFF << 24) + Mth.hsvToRgb(RANDOM.nextFloat(), RANDOM.nextFloat(), 1f); + var color = (0xFF << 24) + Mth.hsvToRgb(RANDOM.nextFloat(), RANDOM.nextFloat(), v); DisplayUtil.renderRectBorder(ctx.pose().last().pose(), buf, bx, by, bw, bh, 1, color, color); ctx.pose().popPose(); ctx.flush(); } - }; + + } } diff --git a/src/main/java/mcp/mobius/waila/gui/hud/InspectComponent.java b/src/main/java/mcp/mobius/waila/gui/hud/InspectComponent.java new file mode 100644 index 00000000..b49c9274 --- /dev/null +++ b/src/main/java/mcp/mobius/waila/gui/hud/InspectComponent.java @@ -0,0 +1,60 @@ +package mcp.mobius.waila.gui.hud; + +import mcp.mobius.waila.api.IPluginInfo; +import mcp.mobius.waila.api.ITooltipComponent; +import net.minecraft.client.DeltaTracker; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.resources.ResourceLocation; + +@SuppressWarnings("deprecation") +public class InspectComponent implements ITooltipComponent { + + public final ITooltipComponent actual; + public final IPluginInfo plugin; + public final Class provider; + public final ResourceLocation tag; + + public InspectComponent(ITooltipComponent actual, IPluginInfo plugin, Class provider, ResourceLocation tag) { + this.actual = actual; + this.plugin = plugin; + this.provider = provider; + this.tag = tag; + } + + @Override + public int getWidth() { + return actual.getWidth(); + } + + @Override + public int getHeight() { + return actual.getHeight(); + } + + @Override + public void render(GuiGraphics ctx, int x, int y, DeltaTracker delta) { + actual.render(ctx, x, y, delta); + } + + public static class Growing extends InspectComponent implements HorizontalGrowing { + + public final HorizontalGrowing actual; + + public Growing(HorizontalGrowing actual, IPluginInfo plugin, Class provider, ResourceLocation tag) { + super(actual, plugin, provider, tag); + this.actual = actual; + } + + @Override + public int getMinimalWidth() { + return actual.getMinimalWidth(); + } + + @Override + public void setGrownWidth(int grownWidth) { + actual.setGrownWidth(grownWidth); + } + + } + +} diff --git a/src/main/java/mcp/mobius/waila/gui/hud/Line.java b/src/main/java/mcp/mobius/waila/gui/hud/Line.java index d68712dc..27f83bbd 100644 --- a/src/main/java/mcp/mobius/waila/gui/hud/Line.java +++ b/src/main/java/mcp/mobius/waila/gui/hud/Line.java @@ -19,12 +19,13 @@ public class Line implements ITooltipLine { - @Nullable - public final ResourceLocation tag; + public final @Nullable ResourceLocation tag; public final List components = new ArrayList<>(); public final Object2IntOpenHashMap widths = new Object2IntOpenHashMap<>(); public final Object2IntMap heights = new Object2IntOpenHashMap<>(); + public Wrapper wrapper = (t, c) -> c; + private int fixedWidth = -1; private int width = -1; private int height = -1; @@ -38,6 +39,7 @@ public Line(@Nullable ResourceLocation tag) { @Override public Line with(ITooltipComponent component) { + component = wrapper.wrap(tag, component); components.add(component); if (component instanceof HorizontalGrowing growing) { growingWeight += growing.getWeight(); @@ -154,4 +156,10 @@ public void render(ComponentRenderer renderer, GuiGraphics ctx, int x, int y, De } } + public interface Wrapper { + + ITooltipComponent wrap(ResourceLocation tag, ITooltipComponent component); + + } + } diff --git a/src/main/java/mcp/mobius/waila/gui/hud/Tooltip.java b/src/main/java/mcp/mobius/waila/gui/hud/Tooltip.java index d9fa8686..b4cd66aa 100644 --- a/src/main/java/mcp/mobius/waila/gui/hud/Tooltip.java +++ b/src/main/java/mcp/mobius/waila/gui/hud/Tooltip.java @@ -6,10 +6,12 @@ import mcp.mobius.waila.api.ITooltip; import mcp.mobius.waila.api.ITooltipLine; import net.minecraft.resources.ResourceLocation; +import org.jetbrains.annotations.Nullable; public class Tooltip extends ObjectArrayList implements ITooltip { private final Object2IntMap tags = new Object2IntOpenHashMap<>(); + public @Nullable Line.Wrapper wrapper; public void setLine(ResourceLocation tag, Line line) { if (tags.containsKey(tag)) { @@ -27,12 +29,15 @@ public int getLineCount() { @Override public ITooltipLine getLine(int index) { - return get(index); + var line = get(index); + if (wrapper != null) line.wrapper = wrapper; + return line; } @Override public ITooltipLine addLine() { var line = new Line(null); + if (wrapper != null) line.wrapper = wrapper; add(line); return line; } @@ -40,6 +45,7 @@ public ITooltipLine addLine() { @Override public ITooltipLine setLine(ResourceLocation tag) { var line = new Line(tag); + if (wrapper != null) line.wrapper = wrapper; setLine(tag, line); return line; } diff --git a/src/main/java/mcp/mobius/waila/gui/hud/TooltipRenderer.java b/src/main/java/mcp/mobius/waila/gui/hud/TooltipRenderer.java index 7a64c256..e17092db 100644 --- a/src/main/java/mcp/mobius/waila/gui/hud/TooltipRenderer.java +++ b/src/main/java/mcp/mobius/waila/gui/hud/TooltipRenderer.java @@ -83,6 +83,10 @@ public static void add(Line line) { } for (var component : line.components) { + if (component instanceof InspectComponent wrapper) { + component = wrapper.actual; + } + if (component instanceof PairComponent pair) { colonOffset = Math.max(pair.key.getWidth(), colonOffset); break; @@ -103,9 +107,10 @@ public static Rectangle endBuild() { for (var entry : Registrar.get().eventListeners.get(Object.class)) { var pa = entry.instance(); var listener = pa.instance(); - accessor.setOrigin(pa.origin(), listener.getClass()); + var wrapperFactory = ComponentHandler.wrapperFactory; + if (wrapperFactory != null) TOOLTIP.wrapper = wrapperFactory.apply(pa); listener.onHandleTooltip(TOOLTIP, accessor, PluginConfig.CLIENT); - accessor.setOrigin(null, null); + if (wrapperFactory != null) TOOLTIP.wrapper = null; } } @@ -186,13 +191,13 @@ public static void resetState() { state = null; } - public static void render(ComponentRenderer renderer, GuiGraphics ctx, DeltaTracker delta) { + public static void render(GuiGraphics ctx, DeltaTracker delta) { try (var ignored = ProfilerUtil.profile("wthit:render")) { - _render(renderer, ctx, delta); + _render(ctx, delta); } } - private static void _render(ComponentRenderer renderer, GuiGraphics ctx, DeltaTracker delta) { + private static void _render(GuiGraphics ctx, DeltaTracker delta) { var client = Minecraft.getInstance(); if (WailaClient.showFps) { @@ -211,7 +216,7 @@ private static void _render(ComponentRenderer renderer, GuiGraphics ctx, DeltaTr // TODO: Figure out why opacity not working properly //noinspection ConstantValue if (true) { - renderUncached(renderer, ctx, delta); + renderUncached(ctx, delta); return; } @@ -235,7 +240,7 @@ private static void _render(ComponentRenderer renderer, GuiGraphics ctx, DeltaTr client.getMainRenderTarget().unbindWrite(); framebuffer.clear(); framebuffer.bindWrite(true); - renderUncached(renderer, ctx, delta); + renderUncached(ctx, delta); framebuffer.unbindWrite(); client.getMainRenderTarget().bindWrite(true); lastFrame = now; @@ -262,13 +267,14 @@ private static void _render(ComponentRenderer renderer, GuiGraphics ctx, DeltaTr RenderSystem.disableBlend(); } - private static void renderUncached(ComponentRenderer renderer, GuiGraphics ctx, DeltaTracker delta) { + private static void renderUncached(GuiGraphics ctx, DeltaTracker delta) { try (var ignored = ProfilerUtil.profile("wthit:render_uncached")) { - _renderUncached(renderer, ctx, delta); + _renderUncached(ctx, delta); } } - private static void _renderUncached(ComponentRenderer renderer, GuiGraphics ctx, DeltaTracker delta) { + private static void _renderUncached(GuiGraphics ctx, DeltaTracker delta) { + var renderer = ComponentRenderer.get(); var scale = state.getScale(); ctx.pose().pushPose(); diff --git a/src/main/java/mcp/mobius/waila/gui/screen/InspectorScreen.java b/src/main/java/mcp/mobius/waila/gui/screen/InspectorScreen.java index f3e61528..9f120e7c 100644 --- a/src/main/java/mcp/mobius/waila/gui/screen/InspectorScreen.java +++ b/src/main/java/mcp/mobius/waila/gui/screen/InspectorScreen.java @@ -1,82 +1,112 @@ package mcp.mobius.waila.gui.screen; +import java.util.ArrayList; +import java.util.List; + import mcp.mobius.waila.Waila; -import mcp.mobius.waila.WailaClient; import mcp.mobius.waila.api.ITheme; import mcp.mobius.waila.api.ITooltipComponent; import mcp.mobius.waila.api.IWailaConfig; import mcp.mobius.waila.buildconst.Tl; +import mcp.mobius.waila.gui.hud.ComponentHandler; import mcp.mobius.waila.gui.hud.ComponentRenderer; +import mcp.mobius.waila.gui.hud.InspectComponent; import mcp.mobius.waila.gui.hud.TooltipHandler; import mcp.mobius.waila.gui.hud.TooltipRenderer; import net.minecraft.client.DeltaTracker; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import org.jetbrains.annotations.NotNull; public class InspectorScreen extends YesIAmSureTheClientInstanceIsPresentByTheTimeIUseItScreen { - private static final Component TITLE = Component.translatable(Tl.Gui.Inspect.TITLE); + private static final String API_COMPONENTS = "mcp.mobius.waila.api.component."; + private static final Component TITLE = Component.translatable(Tl.Gui.Inspector.TITLE); private static final State STATE = new State(); - private final boolean initShowBounds; private final Renderer renderer = new Renderer(); - private InspectorScreen(boolean initShowBounds) { - super(TITLE); - this.initShowBounds = initShowBounds; - } + private boolean tickSuccess = false; - public static boolean open() { - var client = Minecraft.getInstance(); - var success = TooltipHandler.tick(STATE, true); - if (!success) return false; + private final List hoveredComponent = new ArrayList<>(); - client.setScreen(new InspectorScreen(WailaClient.showComponentBounds)); - WailaClient.showComponentBounds = true; - return true; + public InspectorScreen() { + super(TITLE); } @Override protected void init() { super.init(); - var success = TooltipHandler.tick(STATE, true); + ComponentHandler.wrapperFactory = pa -> (tag, c) -> { + if (c instanceof ITooltipComponent.HorizontalGrowing hg) { + return new InspectComponent.Growing(hg, pa.origin(), pa.instance().getClass(), tag); + } + return new InspectComponent(c, pa.origin(), pa.instance().getClass(), tag); + }; + + tickSuccess = TooltipHandler.tick(STATE, true); + ComponentHandler.wrapperFactory = null; } @Override public void onClose() { super.onClose(); - WailaClient.showComponentBounds = initShowBounds; + TooltipHandler.tick(); } @Override public void render(@NotNull GuiGraphics ctx, int mouseX, int mouseY, float tickDelta) { super.render(ctx, mouseX, mouseY, tickDelta); - renderer.mouseX = mouseX; - renderer.mouseY = mouseY; - renderer.hoveredComponent = null; - TooltipRenderer.render(renderer, ctx, minecraft.getDeltaTracker()); + if (!hoveredComponent.isEmpty()) { + var h = minecraft.font.lineHeight + 2; + + var component = hoveredComponent.getFirst(); + if (component instanceof InspectComponent wrapper) component = wrapper.actual; + var clazz = component.getClass().getName(); + if (clazz.startsWith(API_COMPONENTS)) clazz = clazz.substring(API_COMPONENTS.length()); + ctx.drawString(minecraft.font, Component.literal(clazz), 5, 5, 0xFFFFFF); - if (renderer.hoveredComponent != null) { - ctx.renderTooltip(minecraft.font, Component.literal(renderer.hoveredComponent.getClass().getName()), mouseX, mouseY); + var wrapper = (InspectComponent) hoveredComponent.getLast(); + ctx.drawString(minecraft.font, Component.translatable(Tl.Gui.Inspector.TAG, wrapper.tag), 5, 5 + h, 0xFFFFFF); + + var provider = wrapper.provider.getName(); + ctx.drawString(minecraft.font, Component.translatable(Tl.Gui.Inspector.PROVIDER, provider), 5, 5 + h * 2, 0xFFFFFF); + + var pluginId = wrapper.plugin.getPluginId().toString(); + ctx.drawString(minecraft.font, Component.translatable(Tl.Gui.Inspector.PLUGIN_ID, pluginId), 5, 5 + h * 3, 0xFFFFFF); + + var mod = wrapper.plugin.getModInfo(); + ctx.drawString(minecraft.font, Component.translatable(Tl.Gui.Inspector.MOD, mod.getName(), mod.getId()), 5, 5 + h * 4, 0xFFFFFF); + } + + if (tickSuccess) { + renderer.mouseX = mouseX; + renderer.mouseY = mouseY; + hoveredComponent.clear(); + + ComponentRenderer.set(renderer); + TooltipRenderer.render(ctx, minecraft.getDeltaTracker()); + ComponentRenderer.set(null); } } - private static class Renderer implements ComponentRenderer { + private class Renderer extends ComponentRenderer { int mouseX, mouseY; - ITooltipComponent hoveredComponent; @Override public void render(GuiGraphics ctx, ITooltipComponent component, int x, int y, int cw, int ch, DeltaTracker delta) { - ComponentRenderer.DEFAULT.render(ctx, component, x, y, cw, ch, delta); + component.render(ctx, x, y, delta); + var v = 0.3f; if (x < mouseX && mouseX < (x + cw) && y < mouseY && mouseY < (y + ch)) { - hoveredComponent = component; + hoveredComponent.add(component); + v = 1f; } + + ComponentRenderer.Default.renderBounds(ctx, x, y, cw, ch, v); } } diff --git a/src/main/java/mcp/mobius/waila/gui/screen/ThemeEditorScreen.java b/src/main/java/mcp/mobius/waila/gui/screen/ThemeEditorScreen.java index 97e4d4c9..16c94d80 100644 --- a/src/main/java/mcp/mobius/waila/gui/screen/ThemeEditorScreen.java +++ b/src/main/java/mcp/mobius/waila/gui/screen/ThemeEditorScreen.java @@ -6,7 +6,6 @@ import mcp.mobius.waila.api.ITheme; import mcp.mobius.waila.api.IWailaConfig.Overlay.Position.Align; import mcp.mobius.waila.buildconst.Tl; -import mcp.mobius.waila.gui.hud.ComponentRenderer; import mcp.mobius.waila.gui.hud.TooltipRenderer; import mcp.mobius.waila.gui.hud.theme.ThemeAccessor; import mcp.mobius.waila.gui.hud.theme.ThemeDefinition; @@ -180,7 +179,7 @@ private void addTypeProperties(ConfigListWidget options) { @Override protected void renderForeground(GuiGraphics ctx, int rowLeft, int rowWidth, int mouseX, int mouseY, float partialTicks) { - TooltipRenderer.render(ComponentRenderer.DEFAULT, ctx, minecraft.getDeltaTracker()); + TooltipRenderer.render(ctx, minecraft.getDeltaTracker()); } @Override diff --git a/src/main/java/mcp/mobius/waila/gui/screen/WailaConfigScreen.java b/src/main/java/mcp/mobius/waila/gui/screen/WailaConfigScreen.java index 88194e15..b73370cc 100644 --- a/src/main/java/mcp/mobius/waila/gui/screen/WailaConfigScreen.java +++ b/src/main/java/mcp/mobius/waila/gui/screen/WailaConfigScreen.java @@ -14,7 +14,6 @@ import mcp.mobius.waila.api.component.ItemComponent; import mcp.mobius.waila.buildconst.Tl; import mcp.mobius.waila.config.WailaConfig; -import mcp.mobius.waila.gui.hud.ComponentRenderer; import mcp.mobius.waila.gui.hud.Line; import mcp.mobius.waila.gui.hud.TooltipRenderer; import mcp.mobius.waila.gui.hud.theme.ThemeDefinition; @@ -123,7 +122,7 @@ public void render(@NotNull GuiGraphics ctx, int mouseX, int mouseY, float parti } renderBackground(ctx, mouseX, mouseY, partialTicks); - TooltipRenderer.render(ComponentRenderer.DEFAULT, ctx, minecraft.getDeltaTracker()); + TooltipRenderer.render(ctx, minecraft.getDeltaTracker()); } else { TooltipRenderer.resetState(); f1held = false; diff --git a/src/main/java/mcp/mobius/waila/service/ApiService.java b/src/main/java/mcp/mobius/waila/service/ApiService.java index 43cb58c8..ffdb3acf 100644 --- a/src/main/java/mcp/mobius/waila/service/ApiService.java +++ b/src/main/java/mcp/mobius/waila/service/ApiService.java @@ -123,7 +123,7 @@ public IWailaConfig getConfig() { @Override public void renderComponent(GuiGraphics ctx, ITooltipComponent component, int x, int y, DeltaTracker delta) { - ComponentRenderer.DEFAULT.render(ctx, component, x, y, component.getWidth(), component.getHeight(), delta); + ComponentRenderer.get().render(ctx, component, x, y, component.getWidth(), component.getHeight(), delta); } @Override diff --git a/src/main/java/mcp/mobius/waila/service/MixedService.java b/src/main/java/mcp/mobius/waila/service/MixedService.java index a009268d..3638fc40 100644 --- a/src/main/java/mcp/mobius/waila/service/MixedService.java +++ b/src/main/java/mcp/mobius/waila/service/MixedService.java @@ -6,7 +6,6 @@ import mcp.mobius.waila.WailaClient; import mcp.mobius.waila.config.JsonConfig; import mcp.mobius.waila.config.PluginConfig; -import mcp.mobius.waila.gui.hud.ComponentRenderer; import mcp.mobius.waila.gui.hud.TooltipRenderer; import mcp.mobius.waila.mixed.IMixedService; import mcp.mobius.waila.registry.RegistryFilter; @@ -31,7 +30,7 @@ public void onServerLogin() { @Override public void onGuiRender(GuiGraphics ctx, DeltaTracker delta) { - TooltipRenderer.render(ComponentRenderer.DEFAULT, ctx, delta); + TooltipRenderer.render(ctx, delta); } @Override diff --git a/src/resources/resources/assets/waila/lang/en_us.json b/src/resources/resources/assets/waila/lang/en_us.json index 1f1a24ca..4ec5dce0 100644 --- a/src/resources/resources/assets/waila/lang/en_us.json +++ b/src/resources/resources/assets/waila/lang/en_us.json @@ -106,7 +106,11 @@ "gui.waila.credits.authors" : "Authors", "gui.waila.credits.contributors" : "Contributors", - "gui.waila.inspect.title" : "Inspect", + "gui.waila.inspector.title" : "Inspector", + "gui.waila.inspector.tag" : "Tag: %s", + "gui.waila.inspector.provider" : "Provider: %s", + "gui.waila.inspector.plugin_id" : "Plugin ID: %s", + "gui.waila.inspector.mod" : "Mod: %s (%s)", "json5.waila.config.default_value" : "Default value: [%s]", "json5.waila.config.available_values" : "Available values: [%s]",