-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6880da
commit 8f60698
Showing
11 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/main/java/ru/octol1ttle/flightassistant/alerts/nav/gpws/UnsafeTerrainClearanceAlert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package ru.octol1ttle.flightassistant.alerts.nav.gpws; | ||
|
||
import net.minecraft.client.font.TextRenderer; | ||
import net.minecraft.client.gui.DrawContext; | ||
import net.minecraft.text.Text; | ||
import org.jetbrains.annotations.NotNull; | ||
import ru.octol1ttle.flightassistant.HudComponent; | ||
import ru.octol1ttle.flightassistant.alerts.AlertSoundData; | ||
import ru.octol1ttle.flightassistant.alerts.BaseAlert; | ||
import ru.octol1ttle.flightassistant.alerts.ICenteredAlert; | ||
import ru.octol1ttle.flightassistant.computers.safety.GPWSComputer; | ||
import ru.octol1ttle.flightassistant.config.FAConfig; | ||
|
||
public class UnsafeTerrainClearanceAlert extends BaseAlert implements ICenteredAlert { | ||
private final GPWSComputer gpws; | ||
|
||
public UnsafeTerrainClearanceAlert(GPWSComputer gpws) { | ||
this.gpws = gpws; | ||
} | ||
|
||
@Override | ||
public boolean isTriggered() { | ||
return gpws.landingClearanceStatus == GPWSComputer.LandingClearanceStatus.TOO_LOW; | ||
} | ||
|
||
@Override | ||
public @NotNull AlertSoundData getSoundData() { | ||
return AlertSoundData.ifEnabled(FAConfig.computer().landingClearanceWarning, AlertSoundData.TOO_LOW_TERRAIN); | ||
} | ||
|
||
@Override | ||
public boolean render(TextRenderer textRenderer, DrawContext context, int x, int y, boolean highlight) { | ||
if (FAConfig.computer().landingClearanceWarning.screenDisabled()) { | ||
return false; | ||
} | ||
|
||
HudComponent.drawHighlightedMiddleAlignedText(textRenderer, context, Text.translatable("alerts.flightassistant.too_low_terrain"), x, y, | ||
FAConfig.indicator().cautionColor, highlight); | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.