Skip to content

Commit

Permalink
WIP: Improve Instrument and MusicVenueTool overlays.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeronica committed Feb 29, 2024
1 parent cedc5b2 commit 8cffcfa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,21 @@ public static void render(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.
if (isPlacardInHotBar()) {
ITextComponent infoText = new StringTextComponent("")
.append(String.format("%s %s", mc.getSoundManager().getDebugString(), ClientAudio.getDebugString())).withStyle(TextFormatting.WHITE);
final MatrixStack pPoseStack = event.getMatrixStack();
RenderSystem.color3f(1.0F, 1.0F, 1.0F);

final ITextComponent infoText = new StringTextComponent("")
.append(String.format("%s, %s", mc.getSoundManager().getDebugString(), ClientAudio.getDebugString())).withStyle(TextFormatting.WHITE);
final int[] posY = { 0 };
posY[0] = (25);
mc.font.drawShadow(pPoseStack, infoText, 5.0F, posY[0] += 10, -11534256);
ClientAudio.getAudioData().forEach(audioData -> mc.font.drawShadow(pPoseStack, audioData.getInfo(), 5, posY[0] += 10, -11534256));
}
}

/**
* @return true if mxtune:placard_item is on the hot-bar, and the player is not in a portal.
*/
private static boolean isPlacardInHotBar() {
int slot = getPlayer().inventory.findSlotMatchingItem(PLACARD_ITEM);
return slot >= 0 && slot < 9 && !(getPlayer().portalTime > 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private ClientAudio() { /* NOP */ }

public static String getDebugString()
{
return String.format("AudioData %d/%d/%d", ActiveAudio.getDistanceSortedSources().size(), ActiveAudio.getDeleteQueueSize(), ActiveAudio.getCachedMidiSequenceCount());
return String.format("AudioData numSources: %d, deleteQ: %d, seqQ: %d", ActiveAudio.getDistanceSortedSources().size(), ActiveAudio.getDeleteQueueSize(), ActiveAudio.getCachedMidiSequenceCount());
}

public static List<AudioData> getAudioData()
Expand Down

0 comments on commit 8cffcfa

Please sign in to comment.