From a751a769e770ace6410f17c8bc3930490cd4ce3c Mon Sep 17 00:00:00 2001 From: Aeronica Date: Thu, 29 Feb 2024 07:55:54 -0600 Subject: [PATCH] WIP: Improve Instrument and MusicVenueTool overlays. --- .../mods/mxtune/render/InstrumentOverlayRenderer.java | 4 ++-- .../java/aeronicamc/mods/mxtune/render/OverlayInst.java | 9 --------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/main/java/aeronicamc/mods/mxtune/render/InstrumentOverlayRenderer.java b/src/main/java/aeronicamc/mods/mxtune/render/InstrumentOverlayRenderer.java index 56931541..c060bf66 100644 --- a/src/main/java/aeronicamc/mods/mxtune/render/InstrumentOverlayRenderer.java +++ b/src/main/java/aeronicamc/mods/mxtune/render/InstrumentOverlayRenderer.java @@ -12,9 +12,9 @@ import static aeronicamc.mods.mxtune.render.RenderHelper.mc; public class InstrumentOverlayRenderer { + @SuppressWarnings("deprecation") public static void render(ItemStack itemStack, RenderGameOverlayEvent.Post event) { - // Display basic info about the instrument and tune. Optionally, displays some debug info depending on MXTune.isDevEnv flag. - // Based on the toast renderer for testing some ideas. + // Display basic info about the instrument and tune. if (event.getType() == RenderGameOverlayEvent.ElementType.ALL && (mc.screen == null) && itemStack.getItem() instanceof IInstrument) { final ItemStack sheetMusic = SheetMusicHelper.getIMusicFromIInstrument(itemStack); final ITextComponent titleText = SheetMusicHelper.getFormattedMusicTitle(sheetMusic); diff --git a/src/main/java/aeronicamc/mods/mxtune/render/OverlayInst.java b/src/main/java/aeronicamc/mods/mxtune/render/OverlayInst.java index bc8f9221..01d91a38 100644 --- a/src/main/java/aeronicamc/mods/mxtune/render/OverlayInst.java +++ b/src/main/java/aeronicamc/mods/mxtune/render/OverlayInst.java @@ -1,14 +1,11 @@ package aeronicamc.mods.mxtune.render; -import aeronicamc.mods.mxtune.sound.ClientAudio; import aeronicamc.mods.mxtune.util.SheetMusicHelper; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.gui.toasts.IToast; import net.minecraft.item.ItemStack; import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; import static aeronicamc.mods.mxtune.render.RenderHelper.mc; @@ -16,13 +13,9 @@ public class OverlayInst implements IOverlayItem { private final ItemStack itemStack; private long lastChanged; private boolean changed; - private ItemStack sheetMusic; private ITextComponent titleText; private ITextComponent extraText; - private ITextComponent infoText; - - private int offset; private OverlayInst() { @@ -34,8 +27,6 @@ public OverlayInst(ItemStack itemStack) { this.sheetMusic = SheetMusicHelper.getIMusicFromIInstrument(itemStack); this.titleText = SheetMusicHelper.getFormattedMusicTitle(sheetMusic); this.extraText = SheetMusicHelper.getFormattedExtraText(sheetMusic); - this.infoText = new StringTextComponent("").append(SheetMusicHelper.getFormattedMusicDuration(sheetMusic)) - .append(String.format(" %s %s", mc.getSoundManager().getDebugString(), ClientAudio.getDebugString())).withStyle(TextFormatting.WHITE); offset = Math.max(Math.max(mc.font.width(titleText), mc.font.width(extraText)) + 40, this.width()); }