11/*
2- * Copyright (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
2+ * Copyright (c) 2022-2024 lax1dude, ayunami2000, Stoppedwumm . All Rights Reserved.
33 *
44 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2222import java .util .List ;
2323import java .util .Set ;
2424
25- import net .lax1dude .eaglercraft .v1_8 .EagRuntime ;
2625import net .lax1dude .eaglercraft .v1_8 .EaglercraftUUID ;
2726import net .lax1dude .eaglercraft .v1_8 .Keyboard ;
2827import net .lax1dude .eaglercraft .v1_8 .opengl .GlStateManager ;
@@ -38,8 +37,6 @@ public class GuiVoiceOverlay extends Gui {
3837 public int width ;
3938 public int height ;
4039
41- private long pttTimer = 0l ;
42-
4340 public GuiVoiceOverlay (Minecraft mc ) {
4441 this .mc = mc ;
4542 }
@@ -83,26 +80,15 @@ public void drawOverlay() {
8380
8481 mc .getTextureManager ().bindTexture (voiceGuiIcons );
8582
86- if ((mc .currentScreen == null || !mc .currentScreen .blockPTTKey ()) && Keyboard .isKeyDown (mc .gameSettings .voicePTTKey )) {
87- long millis = EagRuntime .steadyTimeMillis ();
88- if (pttTimer == 0l ) {
89- pttTimer = millis ;
90- }
83+ if (VoiceClientController .isTalking ()) {
84+ // Draw the "ON" icon (red microphone)
9185 GlStateManager .color (0.2f , 0.2f , 0.2f , 1.0f );
9286 drawTexturedModalRect (0 , 0 , 0 , 64 , 32 , 32 );
9387 GlStateManager .translate (-1.5f , -1.5f , 0.0f );
94- if (millis - pttTimer < 1050l ) {
95- if ((millis - pttTimer ) % 300l < 150l ) {
96- GlStateManager .color (0.9f , 0.2f , 0.2f , 1.0f );
97- }else {
98- GlStateManager .color (0.9f , 0.7f , 0.7f , 1.0f );
99- }
100- }else {
101- GlStateManager .color (0.9f , 0.3f , 0.3f , 1.0f );
102- }
88+ GlStateManager .color (0.9f , 0.3f , 0.3f , 1.0f );
10389 drawTexturedModalRect (0 , 0 , 0 , 64 , 32 , 32 );
104- }else {
105- pttTimer = 0l ;
90+ } else {
91+ // Draw the "OFF" icon (white microphone)
10692 GlStateManager .color (0.2f , 0.2f , 0.2f , 1.0f );
10793 drawTexturedModalRect (0 , 0 , 0 , 32 , 32 , 32 );
10894 GlStateManager .translate (-1.5f , -1.5f , 0.0f );
@@ -170,7 +156,6 @@ public void drawOverlay() {
170156
171157 for (int i = 0 , l = listenerList .size (); i < l && i < 5 ; ++i ) {
172158 boolean speaking = speakers .contains (listenerList .get (i ));
173- float speakf = speaking ? 1.0f : 0.75f ;
174159
175160 drawString (mc .fontRendererObj , listenerListStr .get (i ), ww - left , hh - 13 - i * 11 , speaking ? 0xEEEEEE : 0xBBBBBB );
176161
@@ -179,6 +164,7 @@ public void drawOverlay() {
179164 GlStateManager .pushMatrix ();
180165 GlStateManager .translate (ww - left - 14 , hh - 14 - i * 11 , 0.0f );
181166
167+ float speakf = speaking ? 1.0f : 0.75f ;
182168 GlStateManager .scale (0.75f , 0.75f , 0.75f );
183169 GlStateManager .color (speakf * 0.2f , speakf * 0.2f , speakf * 0.2f , 1.0f );
184170 drawTexturedModalRect (0 , 0 , 64 , speaking ? 176 : 208 , 16 , 16 );
0 commit comments