diff --git a/src/main/java/net/vulkanmod/config/gui/widget/ModIconWidget.java b/src/main/java/net/vulkanmod/config/gui/widget/ModIconWidget.java index d2cb248a0..9ee69a68a 100644 --- a/src/main/java/net/vulkanmod/config/gui/widget/ModIconWidget.java +++ b/src/main/java/net/vulkanmod/config/gui/widget/ModIconWidget.java @@ -1,7 +1,9 @@ package net.vulkanmod.config.gui.widget; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; import net.minecraft.client.renderer.RenderPipelines; +import net.minecraft.client.sounds.SoundManager; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.FormattedText; import net.minecraft.resources.Identifier; @@ -22,6 +24,10 @@ public ModIconWidget(FormattedText name, Identifier icon, int x0, int y0, int wi this.height = height; } + @Override + public void playDownSound(SoundManager soundManager) { + } + public void render(double mX, double mY) { int backgroundColor = ColorUtil.ARGB.multiplyAlpha(VGuiConstants.COLOR_BLACK, 0.6f); int width = this.width; @@ -29,12 +35,15 @@ public void render(double mX, double mY) { GuiRenderer.fill(this.x, this.y, this.x + width, this.y + height, backgroundColor); - int size = this.height - 4; + int iconSize = this.height - 4; int iconX = this.x + 4; - int iconY = this.y + (height - size) / 2; - GuiRenderer.guiGraphics.blit(RenderPipelines.GUI_TEXTURED, icon, iconX, iconY, 0f, 0f, size, size, size, size); + int iconY = this.y + (height - iconSize) / 2; + GuiRenderer.guiGraphics.blit(RenderPipelines.GUI_TEXTURED, icon, iconX, iconY, 0f, 0f, iconSize, iconSize, iconSize, iconSize); + Font textRenderer = Minecraft.getInstance().font; + + int size = this.height; + int maxWidth = this.width - iconSize - 8; - size = this.height; - GuiRenderer.drawString(Minecraft.getInstance().font, (Component) this.name, this.x + 6 + size, this.y + this.height / 2 - 4, 0xffffffff); + GuiRenderer.drawScrollingString(textRenderer, (Component) this.name, this.x + size + maxWidth / 2 + 3, this.y + this.height / 2 - 4, maxWidth - 4, 0xffffffff); } }