From 4b3d2574d7fa56e481bc9a45355e9386a6270da2 Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Sat, 28 Oct 2023 17:53:23 +0500 Subject: [PATCH] how am I supposed to split these changes Signed-off-by: Octol1ttle --- .../flightassistant/HudComponent.java | 2 +- .../flightassistant/HudRenderer.java | 7 ++-- .../firework/FireworkCountZeroAlert.java | 39 +++++++++++++++++ .../firework/FireworkLowCountAlert.java | 39 +++++++++++++++++ .../alerts/other/ElytraHealthLowAlert.java | 36 ++++++++++++++++ .../{ => other}/InternalErrorAlert.java | 5 ++- .../alerts/{ => other}/StallAlert.java | 4 +- .../computers/AlertController.java | 42 +++++++++++++------ .../computers/AutoFlightComputer.java | 2 +- .../computers/FireworkManager.java | 16 +++++++ .../computers/FlightComputer.java | 13 +++--- .../computers/GPWSComputer.java | 20 ++++----- .../computers/PitchController.java | 1 - .../indicators/ElytraHealthIndicator.java | 7 +++- .../indicators/FlightModeIndicator.java | 2 +- .../indicators/HeadingIndicator.java | 2 - .../mixin/GameRendererMixin.java | 2 +- .../assets/flightassistant/lang/en_us.json | 5 +++ .../assets/flightassistant/lang/ru_ru.json | 5 +++ 19 files changed, 206 insertions(+), 43 deletions(-) create mode 100644 src/main/java/ru/octol1ttle/flightassistant/alerts/firework/FireworkCountZeroAlert.java create mode 100644 src/main/java/ru/octol1ttle/flightassistant/alerts/firework/FireworkLowCountAlert.java create mode 100644 src/main/java/ru/octol1ttle/flightassistant/alerts/other/ElytraHealthLowAlert.java rename src/main/java/ru/octol1ttle/flightassistant/alerts/{ => other}/InternalErrorAlert.java (82%) rename src/main/java/ru/octol1ttle/flightassistant/alerts/{ => other}/StallAlert.java (91%) diff --git a/src/main/java/ru/octol1ttle/flightassistant/HudComponent.java b/src/main/java/ru/octol1ttle/flightassistant/HudComponent.java index 038dc8b3..3aa03cba 100644 --- a/src/main/java/ru/octol1ttle/flightassistant/HudComponent.java +++ b/src/main/java/ru/octol1ttle/flightassistant/HudComponent.java @@ -35,7 +35,7 @@ public static int drawFont(TextRenderer textRenderer, DrawContext context, Strin public static int drawHighlightedFont(TextRenderer textRenderer, DrawContext context, Text text, float x, float y, int highlightColor, boolean highlight) { if (highlight) { drawUnbatched(context, ctx -> { - HudComponent.fill(context, x - 1.5f, y - 1.5f, x + textRenderer.getWidth(text), y + 8.0f, highlightColor); + HudComponent.fill(context, x - 1.5f, y - 1.0f, x + textRenderer.getWidth(text), y + 8.0f, highlightColor); HudComponent.drawFont(textRenderer, context, text, x, y, CONFIG.white); }); return 1; diff --git a/src/main/java/ru/octol1ttle/flightassistant/HudRenderer.java b/src/main/java/ru/octol1ttle/flightassistant/HudRenderer.java index 6c7b6415..a06e4eb3 100644 --- a/src/main/java/ru/octol1ttle/flightassistant/HudRenderer.java +++ b/src/main/java/ru/octol1ttle/flightassistant/HudRenderer.java @@ -38,7 +38,7 @@ public HudRenderer(MinecraftClient mc) { new AltitudeIndicator(computer, dim), new PitchIndicator(computer, dim), new ElytraHealthIndicator(computer, dim), new AlertIndicator(computer, dim), new FlightModeIndicator(computer, dim))); - this.toDelete = new ArrayList<>(); + this.toDelete = new ArrayList<>(components.size()); } public static FlightComputer getComputer() { @@ -99,8 +99,9 @@ public void render(DrawContext context, MinecraftClient mc) { } } - components.removeAll(toDelete); - toDelete.clear(); + if (components.removeAll(toDelete)) { + toDelete.clear(); + } context.getMatrices().pop(); } diff --git a/src/main/java/ru/octol1ttle/flightassistant/alerts/firework/FireworkCountZeroAlert.java b/src/main/java/ru/octol1ttle/flightassistant/alerts/firework/FireworkCountZeroAlert.java new file mode 100644 index 00000000..c4fe1afd --- /dev/null +++ b/src/main/java/ru/octol1ttle/flightassistant/alerts/firework/FireworkCountZeroAlert.java @@ -0,0 +1,39 @@ +package ru.octol1ttle.flightassistant.alerts.firework; + +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.AbstractAlert; +import ru.octol1ttle.flightassistant.alerts.AlertSoundData; +import ru.octol1ttle.flightassistant.alerts.ECAMSoundData; +import ru.octol1ttle.flightassistant.computers.FlightComputer; + +import static ru.octol1ttle.flightassistant.HudComponent.CONFIG; + +public class FireworkCountZeroAlert extends AbstractAlert { + + private final FlightComputer computer; + + public FireworkCountZeroAlert(FlightComputer computer) { + this.computer = computer; + } + + @Override + public boolean isTriggered() { + return computer.firework.safeFireworkCount <= 0; + } + + @Override + public @NotNull AlertSoundData getAlertSoundData() { + return ECAMSoundData.MASTER_CAUTION; + } + + @Override + public int renderECAM(TextRenderer textRenderer, DrawContext context, float x, float y, boolean highlight) { + return HudComponent.drawHighlightedFont(textRenderer, context, Text.translatable("alerts.flightassistant.firework.count_zero"), x, y, + CONFIG.alertColor, + highlight && !dismissed); + } +} \ No newline at end of file diff --git a/src/main/java/ru/octol1ttle/flightassistant/alerts/firework/FireworkLowCountAlert.java b/src/main/java/ru/octol1ttle/flightassistant/alerts/firework/FireworkLowCountAlert.java new file mode 100644 index 00000000..a0eeb1e1 --- /dev/null +++ b/src/main/java/ru/octol1ttle/flightassistant/alerts/firework/FireworkLowCountAlert.java @@ -0,0 +1,39 @@ +package ru.octol1ttle.flightassistant.alerts.firework; + +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.AbstractAlert; +import ru.octol1ttle.flightassistant.alerts.AlertSoundData; +import ru.octol1ttle.flightassistant.alerts.ECAMSoundData; +import ru.octol1ttle.flightassistant.computers.FlightComputer; + +import static ru.octol1ttle.flightassistant.HudComponent.CONFIG; + +public class FireworkLowCountAlert extends AbstractAlert { + + private final FlightComputer computer; + + public FireworkLowCountAlert(FlightComputer computer) { + this.computer = computer; + } + + @Override + public boolean isTriggered() { + return computer.firework.safeFireworkCount > 0 && computer.firework.safeFireworkCount <= 24; + } + + @Override + public @NotNull AlertSoundData getAlertSoundData() { + return ECAMSoundData.MASTER_CAUTION; + } + + @Override + public int renderECAM(TextRenderer textRenderer, DrawContext context, float x, float y, boolean highlight) { + return HudComponent.drawHighlightedFont(textRenderer, context, Text.translatable("alerts.flightassistant.firework.low_count"), x, y, + CONFIG.amberColor, + !dismissed); + } +} \ No newline at end of file diff --git a/src/main/java/ru/octol1ttle/flightassistant/alerts/other/ElytraHealthLowAlert.java b/src/main/java/ru/octol1ttle/flightassistant/alerts/other/ElytraHealthLowAlert.java new file mode 100644 index 00000000..6de6ce31 --- /dev/null +++ b/src/main/java/ru/octol1ttle/flightassistant/alerts/other/ElytraHealthLowAlert.java @@ -0,0 +1,36 @@ +package ru.octol1ttle.flightassistant.alerts.other; + +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.AbstractAlert; +import ru.octol1ttle.flightassistant.alerts.AlertSoundData; +import ru.octol1ttle.flightassistant.alerts.ECAMSoundData; +import ru.octol1ttle.flightassistant.computers.FlightComputer; + +public class ElytraHealthLowAlert extends AbstractAlert { + private final FlightComputer computer; + + public ElytraHealthLowAlert(FlightComputer computer) { + this.computer = computer; + } + + @Override + public boolean isTriggered() { + return computer.elytraHealth <= 5.0f; + } + + @Override + public @NotNull AlertSoundData getAlertSoundData() { + return ECAMSoundData.MASTER_WARNING; + } + + @Override + public int renderECAM(TextRenderer textRenderer, DrawContext context, float x, float y, boolean highlight) { + return HudComponent.drawHighlightedFont(textRenderer, context, Text.translatable("alerts.flightassistant.elytra_health_low"), x, y, + HudComponent.CONFIG.alertColor, + !dismissed && highlight); + } +} \ No newline at end of file diff --git a/src/main/java/ru/octol1ttle/flightassistant/alerts/InternalErrorAlert.java b/src/main/java/ru/octol1ttle/flightassistant/alerts/other/InternalErrorAlert.java similarity index 82% rename from src/main/java/ru/octol1ttle/flightassistant/alerts/InternalErrorAlert.java rename to src/main/java/ru/octol1ttle/flightassistant/alerts/other/InternalErrorAlert.java index d7854a54..ead3b0e8 100644 --- a/src/main/java/ru/octol1ttle/flightassistant/alerts/InternalErrorAlert.java +++ b/src/main/java/ru/octol1ttle/flightassistant/alerts/other/InternalErrorAlert.java @@ -1,10 +1,13 @@ -package ru.octol1ttle.flightassistant.alerts; +package ru.octol1ttle.flightassistant.alerts.other; 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.AbstractAlert; +import ru.octol1ttle.flightassistant.alerts.AlertSoundData; +import ru.octol1ttle.flightassistant.alerts.ECAMSoundData; import ru.octol1ttle.flightassistant.computers.FlightComputer; public class InternalErrorAlert extends AbstractAlert { diff --git a/src/main/java/ru/octol1ttle/flightassistant/alerts/StallAlert.java b/src/main/java/ru/octol1ttle/flightassistant/alerts/other/StallAlert.java similarity index 91% rename from src/main/java/ru/octol1ttle/flightassistant/alerts/StallAlert.java rename to src/main/java/ru/octol1ttle/flightassistant/alerts/other/StallAlert.java index cda9d594..6bd55579 100644 --- a/src/main/java/ru/octol1ttle/flightassistant/alerts/StallAlert.java +++ b/src/main/java/ru/octol1ttle/flightassistant/alerts/other/StallAlert.java @@ -1,4 +1,4 @@ -package ru.octol1ttle.flightassistant.alerts; +package ru.octol1ttle.flightassistant.alerts.other; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; @@ -7,6 +7,8 @@ import net.minecraft.util.Identifier; import org.jetbrains.annotations.NotNull; import ru.octol1ttle.flightassistant.HudComponent; +import ru.octol1ttle.flightassistant.alerts.AbstractAlert; +import ru.octol1ttle.flightassistant.alerts.AlertSoundData; import ru.octol1ttle.flightassistant.computers.FlightComputer; import ru.octol1ttle.flightassistant.computers.GPWSComputer; import ru.octol1ttle.flightassistant.computers.StallComputer; diff --git a/src/main/java/ru/octol1ttle/flightassistant/computers/AlertController.java b/src/main/java/ru/octol1ttle/flightassistant/computers/AlertController.java index bc36ca86..b5513d9a 100644 --- a/src/main/java/ru/octol1ttle/flightassistant/computers/AlertController.java +++ b/src/main/java/ru/octol1ttle/flightassistant/computers/AlertController.java @@ -5,45 +5,59 @@ import java.util.List; import net.minecraft.client.sound.SoundManager; import ru.octol1ttle.flightassistant.AlertSoundInstance; +import ru.octol1ttle.flightassistant.FlightAssistant; import ru.octol1ttle.flightassistant.alerts.AbstractAlert; import ru.octol1ttle.flightassistant.alerts.AlertSoundData; -import ru.octol1ttle.flightassistant.alerts.InternalErrorAlert; -import ru.octol1ttle.flightassistant.alerts.StallAlert; import ru.octol1ttle.flightassistant.alerts.autoflight.ATHRNoFireworksInHotbarAlert; +import ru.octol1ttle.flightassistant.alerts.firework.FireworkCountZeroAlert; import ru.octol1ttle.flightassistant.alerts.firework.FireworkDelayedResponseAlert; +import ru.octol1ttle.flightassistant.alerts.firework.FireworkLowCountAlert; import ru.octol1ttle.flightassistant.alerts.firework.FireworkNoResponseAlert; import ru.octol1ttle.flightassistant.alerts.nav.ApproachingVoidDamageLevelAlert; import ru.octol1ttle.flightassistant.alerts.nav.gpws.ExcessiveDescentAlert; import ru.octol1ttle.flightassistant.alerts.nav.gpws.ExcessiveTerrainClosureAlert; +import ru.octol1ttle.flightassistant.alerts.other.ElytraHealthLowAlert; +import ru.octol1ttle.flightassistant.alerts.other.InternalErrorAlert; +import ru.octol1ttle.flightassistant.alerts.other.StallAlert; public class AlertController { public final List activeAlerts; private final FlightComputer computer; private final SoundManager manager; - private final AbstractAlert[] ALERTS; + private final List allAlerts; + private final List toDelete; public AlertController(FlightComputer computer, SoundManager manager) { this.computer = computer; this.manager = manager; // TODO: ECAM actions - ALERTS = new AbstractAlert[]{ + allAlerts = new ArrayList<>(List.of( new StallAlert(computer), new ExcessiveDescentAlert(computer), new ExcessiveTerrainClosureAlert(computer), // GPWS new InternalErrorAlert(computer), new ApproachingVoidDamageLevelAlert(computer), + new ElytraHealthLowAlert(computer), + new FireworkCountZeroAlert(computer), new FireworkNoResponseAlert(computer), new FireworkDelayedResponseAlert(computer), - new ATHRNoFireworksInHotbarAlert(computer) - }; - activeAlerts = new ArrayList<>(); + new FireworkLowCountAlert(computer), + new ATHRNoFireworksInHotbarAlert(computer))); + activeAlerts = new ArrayList<>(allAlerts.size()); + toDelete = new ArrayList<>(allAlerts.size()); } public void tick() { - for (AbstractAlert alert : ALERTS) { - if (alert.isTriggered()) { - if (!activeAlerts.contains(alert)) { - activeAlerts.add(alert); + for (AbstractAlert alert : allAlerts) { + try { + if (alert.isTriggered()) { + if (!activeAlerts.contains(alert)) { + activeAlerts.add(alert); + } + continue; } - continue; + } catch (Exception e) { + FlightAssistant.LOGGER.error("Exception triggering alert", e); + toDelete.add(alert); + computer.internalError = true; } if (!activeAlerts.contains(alert)) { @@ -62,6 +76,10 @@ public void tick() { activeAlerts.remove(alert); } + if (allAlerts.removeAll(toDelete)) { + toDelete.clear(); + } + boolean interrupt = false; activeAlerts.sort(Comparator.comparingDouble(alert -> alert.getAlertSoundData().priority())); for (AbstractAlert alert : activeAlerts) { diff --git a/src/main/java/ru/octol1ttle/flightassistant/computers/AutoFlightComputer.java b/src/main/java/ru/octol1ttle/flightassistant/computers/AutoFlightComputer.java index 3255773b..8b9be702 100644 --- a/src/main/java/ru/octol1ttle/flightassistant/computers/AutoFlightComputer.java +++ b/src/main/java/ru/octol1ttle/flightassistant/computers/AutoFlightComputer.java @@ -15,7 +15,7 @@ public AutoFlightComputer(FlightComputer computer) { } public void tick() { - if (autoThrustEnabled && targetSpeed != null && computer.speed < targetSpeed && computer.gpws.getGPWSLampColor() != CONFIG.alertColor) { + if (autoThrustEnabled && targetSpeed != null && computer.speed < targetSpeed && computer.gpws.getGPWSLampColor() == CONFIG.color) { computer.firework.activateFirework(false); } } diff --git a/src/main/java/ru/octol1ttle/flightassistant/computers/FireworkManager.java b/src/main/java/ru/octol1ttle/flightassistant/computers/FireworkManager.java index b6463e57..9a0cc335 100644 --- a/src/main/java/ru/octol1ttle/flightassistant/computers/FireworkManager.java +++ b/src/main/java/ru/octol1ttle/flightassistant/computers/FireworkManager.java @@ -10,6 +10,7 @@ public class FireworkManager { private final FlightComputer computer; + public int safeFireworkCount; public boolean fireworkResponded = true; public float lastUseTime = -1.0f; public float lastDiff = Float.MAX_VALUE; @@ -23,6 +24,7 @@ public FireworkManager(FlightComputer computer) { public void tick() { // TODO: client<->server communication to confirm firework activation + safeFireworkCount = countSafeFireworks(); if (computer.speed > 30) { fireworkResponded = true; } @@ -31,6 +33,20 @@ public void tick() { } } + private int countSafeFireworks() { + int i = 0; + + PlayerInventory inventory = computer.player.getInventory(); + for (int j = 0; j < inventory.size(); ++j) { + ItemStack itemStack = inventory.getStack(j); + if (isFireworkSafe(itemStack)) { + i += itemStack.getCount(); + } + } + + return i; + } + public boolean activateFirework(boolean togaLock) { if (!computer.canAutomationsActivate() || lastUseTime > 0 && computer.time.prevMillis - lastUseTime < 750) { return false; diff --git a/src/main/java/ru/octol1ttle/flightassistant/computers/FlightComputer.java b/src/main/java/ru/octol1ttle/flightassistant/computers/FlightComputer.java index 870e92c1..9f919b97 100644 --- a/src/main/java/ru/octol1ttle/flightassistant/computers/FlightComputer.java +++ b/src/main/java/ru/octol1ttle/flightassistant/computers/FlightComputer.java @@ -11,7 +11,6 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.joml.Matrix3f; import ru.octol1ttle.flightassistant.FlightAssistant; @@ -34,8 +33,7 @@ public class FlightComputer { public Vec3d position; public Vec3d velocity; public Vec3d velocityPerSecond; - @Nullable - public Vec3d acceleration; + public Vec3d acceleration = Vec3d.ZERO; public float speed; public float pitch; public float yaw; @@ -102,12 +100,13 @@ public void tick() { return; } - gpws.tick(); - autoflight.tick(); - alert.tick(); stall.tick(); + gpws.tick(); voidDamage.tick(); firework.tick(); + autoflight.tick(); + + alert.tick(); } public void updateRoll(Matrix3f normal) { @@ -190,7 +189,7 @@ private int computeVoidLevel() { private float computeDistanceFromGround(float altitude, Integer groundLevel) { - return Math.max(-64f, altitude - groundLevel); + return Math.max(0.0f, altitude - groundLevel); } private float computeAltitude() { diff --git a/src/main/java/ru/octol1ttle/flightassistant/computers/GPWSComputer.java b/src/main/java/ru/octol1ttle/flightassistant/computers/GPWSComputer.java index 45123666..8b9a802c 100644 --- a/src/main/java/ru/octol1ttle/flightassistant/computers/GPWSComputer.java +++ b/src/main/java/ru/octol1ttle/flightassistant/computers/GPWSComputer.java @@ -13,10 +13,9 @@ public class GPWSComputer { public static final int MAX_SAFE_SINK_RATE = 10; public static final float PITCH_CORRECT_THRESHOLD = 2.5f; private static final int MAX_SAFE_GROUND_SPEED = 15; - private static final int STATUS_ACCELERATION_NOT_AVAILABLE = -1; - private static final int STATUS_FALL_DISTANCE_TOO_LOW = -2; - private static final int STATUS_SPEED_SAFE = -3; - private static final int STATUS_NO_TERRAIN_AHEAD = -4; + private static final int STATUS_FALL_DISTANCE_TOO_LOW = -1; + private static final int STATUS_SPEED_SAFE = -2; + private static final int STATUS_NO_TERRAIN_AHEAD = -3; private static final float BLOCK_PITCH_CONTROL_THRESHOLD = 5.0f; private static final float TERRAIN_RAYCAST_AHEAD_SECONDS = 10.0f; private final FlightComputer computer; @@ -64,9 +63,6 @@ public boolean shouldBlockPitchChanges() { } private float computeDescentImpactTime() { - if (computer.acceleration == null) { - return STATUS_ACCELERATION_NOT_AVAILABLE; - } if (computer.player.fallDistance <= 3) { return STATUS_FALL_DISTANCE_TOO_LOW; } @@ -82,10 +78,6 @@ private float computeDescentImpactTime() { } private float computeTerrainImpactTime() { - if (computer.acceleration == null) { - return STATUS_ACCELERATION_NOT_AVAILABLE; - } - Vec3d accelerationVector = computer.acceleration.multiply(TICKS_PER_SECOND); Vec3d end = computer.position.add(computer.velocityPerSecond.multiply(TERRAIN_RAYCAST_AHEAD_SECONDS).add(accelerationVector.multiply(Math.pow(TERRAIN_RAYCAST_AHEAD_SECONDS, 2)).multiply(0.5f))); @@ -105,11 +97,17 @@ private float computeTerrainImpactTime() { } private float getTimeWithAcceleration(double initialSpeed, double acceleration, double path) { + if (acceleration <= 0.0) { + return (float) (path / initialSpeed); + } return (float) ((-initialSpeed + Math.sqrt(Math.pow(initialSpeed, 2) + 2 * acceleration * path)) / acceleration); } private float getSpeedWithAcceleration(double initialSpeed, double acceleration, double time) { + if (acceleration <= 0.0) { + return (float) initialSpeed; + } return (float) (initialSpeed + acceleration * time); } } diff --git a/src/main/java/ru/octol1ttle/flightassistant/computers/PitchController.java b/src/main/java/ru/octol1ttle/flightassistant/computers/PitchController.java index c0577495..90e8997a 100644 --- a/src/main/java/ru/octol1ttle/flightassistant/computers/PitchController.java +++ b/src/main/java/ru/octol1ttle/flightassistant/computers/PitchController.java @@ -74,7 +74,6 @@ public void smoothSetPitch(Float pitch, float delta) { @SafeVarargs private void checkFloatValidity(Float f, String name, Pair... additionalInfo) { - // TODO: convert to alternate law trigger if (f.isNaN() || f.isInfinite() || f < -90.0f || f > 90.0f) { FlightAssistant.LOGGER.error("{} out of bounds: {}", name, f); FlightAssistant.LOGGER.error("Additional information:"); diff --git a/src/main/java/ru/octol1ttle/flightassistant/indicators/ElytraHealthIndicator.java b/src/main/java/ru/octol1ttle/flightassistant/indicators/ElytraHealthIndicator.java index a9317d39..897b43d8 100644 --- a/src/main/java/ru/octol1ttle/flightassistant/indicators/ElytraHealthIndicator.java +++ b/src/main/java/ru/octol1ttle/flightassistant/indicators/ElytraHealthIndicator.java @@ -23,7 +23,12 @@ public void render(DrawContext context, TextRenderer textRenderer) { float y = dim.hScreen * CONFIG.elytra_y; if (CONFIG.elytra_showHealth && computer.elytraHealth != null) { - int color = CONFIG.color; + int color; + if (computer.elytraHealth <= 5.0f) { + color = CONFIG.alertColor; + } else { + color = computer.elytraHealth <= 10.0f ? CONFIG.amberColor : CONFIG.color; + } drawBox(context, x - 3.5f, y - 1.5f, 30, color); drawFont(textRenderer, context, Text.translatable("flightassistant.elytra_short"), x - 10, y, color); drawFont(textRenderer, context, String.format("%d", i(computer.elytraHealth)) + "%", x, y, color); diff --git a/src/main/java/ru/octol1ttle/flightassistant/indicators/FlightModeIndicator.java b/src/main/java/ru/octol1ttle/flightassistant/indicators/FlightModeIndicator.java index 0eb57ef9..7c312b7c 100644 --- a/src/main/java/ru/octol1ttle/flightassistant/indicators/FlightModeIndicator.java +++ b/src/main/java/ru/octol1ttle/flightassistant/indicators/FlightModeIndicator.java @@ -20,7 +20,7 @@ public FlightModeIndicator(FlightComputer computer, Dimensions dim) { public void render(DrawContext context, TextRenderer textRenderer) { float x = dim.lFrame + dim.wFrame * 0.2f; float y = dim.bFrame + 10; - if (computer.firework.lastTogaLock != null && computer.time.prevMillis - computer.firework.lastTogaLock < 1000) { + if (computer.firework.lastTogaLock != null && computer.time.prevMillis - computer.firework.lastTogaLock < 2000) { Text text = Text.translatable("flightassistant.toga_lock"); drawHighlightedFont(textRenderer, context, text, diff --git a/src/main/java/ru/octol1ttle/flightassistant/indicators/HeadingIndicator.java b/src/main/java/ru/octol1ttle/flightassistant/indicators/HeadingIndicator.java index 1eef65b2..9bdfb5e0 100644 --- a/src/main/java/ru/octol1ttle/flightassistant/indicators/HeadingIndicator.java +++ b/src/main/java/ru/octol1ttle/flightassistant/indicators/HeadingIndicator.java @@ -57,8 +57,6 @@ public void render(DrawContext context, TextRenderer textRenderer) { } } } - - // TODO: maybe convert throws into alternate law triggers and disable the component? private Text headingToDirection(int degrees) { return switch (degrees) { case 0, 360 -> Text.translatable("flightassistant.north_short"); diff --git a/src/main/java/ru/octol1ttle/flightassistant/mixin/GameRendererMixin.java b/src/main/java/ru/octol1ttle/flightassistant/mixin/GameRendererMixin.java index 515f9ab0..4f07d118 100644 --- a/src/main/java/ru/octol1ttle/flightassistant/mixin/GameRendererMixin.java +++ b/src/main/java/ru/octol1ttle/flightassistant/mixin/GameRendererMixin.java @@ -25,8 +25,8 @@ private void renderWorld(float tickDelta, MatrixStack matrices, CallbackInfo ci ) { - Matrix3f inverseViewRotationMatrix = RenderSystem.getInverseViewRotationMatrix(); if (HudRenderer.getComputer() != null) { + Matrix3f inverseViewRotationMatrix = RenderSystem.getInverseViewRotationMatrix(); HudRenderer.getComputer().updateRoll(inverseViewRotationMatrix.invert()); } } diff --git a/src/main/resources/assets/flightassistant/lang/en_us.json b/src/main/resources/assets/flightassistant/lang/en_us.json index b4838307..2dd44907 100644 --- a/src/main/resources/assets/flightassistant/lang/en_us.json +++ b/src/main/resources/assets/flightassistant/lang/en_us.json @@ -10,13 +10,18 @@ "alerts.flightassistant.sink_rate": "SINK RATE", "alerts.flightassistant.stall": "STALL", "alerts.flightassistant.terrain_ahead": "TERRAIN AHEAD", + "alerts.flightassistant.internal_mod_error": "INTERNAL MOD ERROR", + "alerts.flightassistant.elytra_health_low": "ELYTRA HEALTH LOW", "alerts.flightassistant.nav.approaching_void_damage_level": "APPROACHING VOID DAMAGE LEVEL", "alerts.flightassistant.nav.reached_void_damage_level": "REACHED VOID DAMAGE LEVEL", "alerts.flightassistant.firework.delayed_response": "FRWK DELAYED RESPONSE", "alerts.flightassistant.firework.no_response": "FRWK NO RESPONSE", "alerts.flightassistant.firework.no_fireworks": "NO FRWKS IN HOTBAR", + "alerts.flightassistant.firework.low_count": "FRWK CNT BELOW 24", + "alerts.flightassistant.firework.count_zero": "FRWK CNT AT ZERO", + "flightassistant.toga_lock": "TOGA LK", "flightassistant.thrust_mode_speed": "SPD %s", "flightassistant.thrust_mode_speed_not_selected": "SPD NOT SEL", diff --git a/src/main/resources/assets/flightassistant/lang/ru_ru.json b/src/main/resources/assets/flightassistant/lang/ru_ru.json index b9f40ac5..c03e031c 100644 --- a/src/main/resources/assets/flightassistant/lang/ru_ru.json +++ b/src/main/resources/assets/flightassistant/lang/ru_ru.json @@ -10,13 +10,18 @@ "alerts.flightassistant.sink_rate": "СКОР. СНИЖЕНИЯ", "alerts.flightassistant.stall": "СВАЛИВАНИЕ", "alerts.flightassistant.terrain_ahead": "ЗЕМЛЯ ВПЕРЕДИ", + "alerts.flightassistant.internal_mod_error": "ВНУТРЕННЯЯ ОШИБКА МОДА", + "alerts.flightassistant.elytra_health_low": "ЗДОРОВЬЕ ЭЛИТР НИЗК", "alerts.flightassistant.nav.approaching_void_damage_level": "ПРИБЛИЖЕНИЕ К ВЫСОТЕ УРОНА ПУСТОТЫ", "alerts.flightassistant.nav.reached_void_damage_level": "ДОСТИГНУТА ВЫСОТА УРОНА ПУСТОТЫ", "alerts.flightassistant.firework.delayed_response": "ФРВК ПОЗДНЯЯ АКТИВАЦИЯ", "alerts.flightassistant.firework.no_response": "ФРВК ОТКАЗ", "alerts.flightassistant.firework.no_fireworks": "НЕТ ФРВКОВ НА ПАНЕЛИ БЫСТР. ДОСТУПА", + "alerts.flightassistant.firework.low_count": "КОЛ-ВО ФРВКОВ НИЖЕ 24", + "alerts.flightassistant.firework.count_zero": "КОЛ-ВО ФРВКОВ НА НУЛЕ", + "flightassistant.toga_lock": "МАКС. ТЯГА", "flightassistant.thrust_mode_speed": "СКОР %s", "flightassistant.thrust_mode_speed_not_selected": "СКОР. НЕ ЗАДАНА",