Skip to content

Commit

Permalink
Fix warnings triggering when fully disabled
Browse files Browse the repository at this point in the history
Signed-off-by: Octol1ttle <[email protected]>
  • Loading branch information
Octol1ttle committed Mar 2, 2024
1 parent 6486997 commit 31008dc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public record AlertSoundData(@Nullable SoundEvent sound, int priority) {
);

public static AlertSoundData ifEnabled(ComputerConfig.WarningMode mode, AlertSoundData data) {
if (mode.screenOnly()) {
if (mode.audioDisabled()) {
return AlertSoundData.EMPTY;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public boolean isTriggered() {

@Override
public boolean render(TextRenderer textRenderer, DrawContext context, int x, int y, boolean highlight) {
if (FAConfig.computer().sinkrateWarning.audioOnly()) {
if (FAConfig.computer().sinkrateWarning.screenDisabled()) {
return false;
}

Expand All @@ -54,7 +54,7 @@ public boolean render(TextRenderer textRenderer, DrawContext context, int x, int

@Override
public @NotNull AlertSoundData getSoundData() {
if (FAConfig.computer().sinkrateWarning.screenOnly()) {
if (FAConfig.computer().sinkrateWarning.audioDisabled()) {
return AlertSoundData.EMPTY;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public boolean isTriggered() {

@Override
public boolean render(TextRenderer textRenderer, DrawContext context, int x, int y, boolean highlight) {
if (FAConfig.computer().terrainWarning.audioOnly()) {
if (FAConfig.computer().terrainWarning.screenDisabled()) {
return false;
}

Expand All @@ -77,7 +77,7 @@ public boolean render(TextRenderer textRenderer, DrawContext context, int x, int

@Override
public @NotNull AlertSoundData getSoundData() {
if (FAConfig.computer().terrainWarning.screenOnly()) {
if (FAConfig.computer().terrainWarning.audioDisabled()) {
return AlertSoundData.EMPTY;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public boolean isTriggered() {

@Override
public boolean render(TextRenderer textRenderer, DrawContext context, int x, int y, boolean highlight) {
if (FAConfig.computer().stallWarning.audioOnly()) {
if (FAConfig.computer().stallWarning.screenDisabled()) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ public enum WarningMode implements NameableEnum {
SCREEN_AND_AUDIO,
AUDIO_ONLY,
SCREEN_ONLY,
@SuppressWarnings("unused") DISABLED;
DISABLED;

public boolean audioOnly() {
return this == AUDIO_ONLY;
public boolean screenDisabled() {
return this == AUDIO_ONLY || this == DISABLED;
}

public boolean screenOnly() {
return this == SCREEN_ONLY;
public boolean audioDisabled() {
return this == SCREEN_ONLY || this == DISABLED;
}

@Override
Expand Down

0 comments on commit 31008dc

Please sign in to comment.