Skip to content

Commit

Permalink
Minor fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
OreCruncher committed Feb 19, 2024
1 parent a96a917 commit 0f1aba7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.client.resources.sounds.SoundInstance;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style;
import net.minecraft.sounds.SoundSource;
import org.orecruncher.dsurround.eventing.ClientEventHooks;
import org.orecruncher.dsurround.eventing.CollectDiagnosticsEvent;
Expand All @@ -18,6 +19,7 @@
public class SoundEngineDiagnosticsPlugin implements IDiagnosticPlugin {

private static final String FMT_DBG_SOUND = "%s: %d";
private static final Style OFF_STYLE = Style.EMPTY.withColor(ColorPalette.RED);

public SoundEngineDiagnosticsPlugin() {
ClientEventHooks.COLLECT_DIAGNOSTICS.register(this::onCollect, HandlerPriority.LOW);
Expand All @@ -31,7 +33,7 @@ public void onCollect(CollectDiagnosticsEvent event) {
for (var category : SoundSource.values()) {
var volumeSettings = GameUtils.getGameSettings().getSoundSourceVolume(category);
if (Float.compare(volumeSettings, 0F) == 0) {
var text = Component.literal("%s is OFF".formatted(category.name())).withColor(ColorPalette.RED.getValue());
var text = Component.literal("%s is OFF".formatted(category.name())).withStyle(OFF_STYLE);
panelText.add(text);
}
}
Expand Down
22 changes: 4 additions & 18 deletions src/main/java/org/orecruncher/dsurround/lib/gui/WarmToast.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,7 @@ public void reset(Component component, @Nullable Component component2) {

int i = this.width();
if (i == 160 && this.messageLines.size() <= 1) {
<<<<<<< HEAD
guiGraphics.blit(this.backgroundSprite, 0, 0, 0, 0, i, this.height());
=======
guiGraphics.blitSprite(this.profile.sprite, 0, 0, i, this.height());
>>>>>>> 6915e84 (Improve individual sound configuration UI for smaller displays (#77))
guiGraphics.blit(this.profile.sprite, 0, 0, 0, 0, i, this.height());
} else {
int renderHeight = this.height();
int lineRenderCount = Math.min(4, renderHeight - 28);
Expand Down Expand Up @@ -108,23 +104,13 @@ public void reset(Component component, @Nullable Component component2) {
private void renderBackgroundRow(GuiGraphics guiGraphics, int i, int j, int k, int l) {
int m = j == 0 ? 20 : 5;
int n = Math.min(60, i - m);
<<<<<<< HEAD
guiGraphics.blit(this.backgroundSprite, 0, k, 0, 0 + j, m, l);
guiGraphics.blit(this.profile.sprite, 0, k, 0, 0 + j, m, l);

for(int o = m; o < i - n; o += 64) {
guiGraphics.blit(this.backgroundSprite, o, k, 32, 0 + j, Math.min(64, i - o - n), l);
guiGraphics.blit(this.profile.sprite, o, k, 32, 0 + j, Math.min(64, i - o - n), l);
}

guiGraphics.blit(this.backgroundSprite, i - n, k, 160 - n, 0 + j, n, l);
=======
guiGraphics.blitSprite(this.profile.sprite, 160, 32, 0, j, 0, k, m, l);

for(int o = m; o < i - n; o += 64) {
guiGraphics.blitSprite(this.profile.sprite, 160, 32, 32, j, o, k, Math.min(64, i - o - n), l);
}

guiGraphics.blitSprite(this.profile.sprite, 160, 32, 160 - n, j, i - n, k, n, l);
>>>>>>> 6915e84 (Improve individual sound configuration UI for smaller displays (#77))
guiGraphics.blit(this.profile.sprite, i - n, k, 160 - n, 0 + j, n, l);
}

private static ImmutableList<FormattedCharSequence> nullToEmpty(@Nullable Component component) {
Expand Down

0 comments on commit 0f1aba7

Please sign in to comment.