added notices, fixed name tags

This commit is contained in:
LAX1DUDE 2022-07-20 23:00:24 -07:00
parent 79b87e32a2
commit 89c72b77f1
6 changed files with 244 additions and 25 deletions

View File

@ -93,6 +93,31 @@ voice.warning1=§cWarning:§r your network does not support the STUN
voice.warning2=connection procedure, a TURN relay will be used as
voice.warning3=fallback, which will greatly impact the audio quality
voice.unsupportedWarning1=Voice Warning
voice.unsupportedWarning2=Your network's firewall may not support
voice.unsupportedWarning3=eaglercraft's voice chat.
voice.unsupportedWarning4=If your game doesn't work it's your issue
voice.unsupportedWarning5=to solve, not ayunami2000's or lax1dude's.
voice.unsupportedWarning6=Don't ask them to 'fix' it for you because
voice.unsupportedWarning7=they won't help you fix a problem that only
voice.unsupportedWarning8=you or your network's administrator has the
voice.unsupportedWarning9=ability to correctly resolve.
voice.unsupportedWarning10=Continue
voice.unsupportedWarning11=Cancel
voice.ipGrabWarning1=IP Logger Warning
voice.ipGrabWarning2=Using Eaglercraft voice chat may allow your
voice.ipGrabWarning3=IP address to be logged by other players
voice.ipGrabWarning4=also using voice on the server.
voice.ipGrabWarning5=This issue will not be fixed, it is an
voice.ipGrabWarning6=internal browser issue, not a mistake in the
voice.ipGrabWarning7=game. Fortunately, this can only be done if
voice.ipGrabWarning8=the other player uses a hacked web browser
voice.ipGrabWarning9=or has Wireshark to capture the voice
voice.ipGrabWarning10=packets, as there exists no real javascript
voice.ipGrabWarning11=method to log IPs using a normal skidded
voice.ipGrabWarning12=eaglercraft hacked client.
selectWorld.title=Select World
selectWorld.empty=empty
selectWorld.world=World

View File

@ -30,10 +30,13 @@ import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import javax.imageio.ImageIO;
import javax.swing.JFileChooser;
@ -70,6 +73,7 @@ import net.lax1dude.eaglercraft.AssetRepository;
import net.lax1dude.eaglercraft.EaglerImage;
import net.lax1dude.eaglercraft.EarlyLoadScreen;
import net.lax1dude.eaglercraft.ServerQuery;
import net.lax1dude.eaglercraft.Voice;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.ProgramGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.RateLimit;
import net.lax1dude.eaglercraft.adapter.lwjgl.GameWindowListener;
@ -1333,27 +1337,95 @@ public class EaglerAdapterImpl2 {
});
}
private static boolean connected = false;
public static final void voiceConnect(String channel) {
connected = true;
}
public static final void voiceVolume(float volume) {
public static void clearVoiceAvailableStatus() {
}
public static final boolean voiceActive() {
return connected;
public static void setVoiceSignalHandler(Consumer<byte[]> signalHandler) {
}
public static void handleVoiceSignal(byte[] data) {
}
public static final boolean voiceAvailable() {
return true;
}
public static final boolean voiceAllowed() {
return true;
}
public static final boolean voiceRelayed() {
return connected;
return false;
}
public static final String[] voiceUsers() {
return new String[0];
public static final void addNearbyPlayer(String username) {
}
public static final String[] voiceUsersTalking() {
return new String[0];
public static final void removeNearbyPlayer(String username) {
}
public static final void voiceEnd() {
connected = false;
public static final void updateVoicePosition(String username, double x, double y, double z) {
}
public static final void sendInitialVoice() {
}
public static final void sendVoiceRequestIfNeeded(String str) {
}
public static final void cleanupNearbyPlayers(Set<String> players) {
}
private static Voice.VoiceChannel enabledChannel = Voice.VoiceChannel.NONE;
public static final void enableVoice(Voice.VoiceChannel enable) {
enabledChannel = enable;
}
public static final Voice.VoiceChannel getVoiceChannel() {
return enabledChannel;
}
public static final Voice.VoiceStatus getVoiceStatus() {
return enabledChannel == Voice.VoiceChannel.NONE ? Voice.VoiceStatus.DISCONNECTED : Voice.VoiceStatus.CONNECTED;
}
public static final void activateVoice(boolean talk) {
}
private static int proximity = 16;
public static final void setVoiceProximity(int prox) {
proximity = prox;
}
public static final int getVoiceProximity() {
return proximity;
}
private static float volumeListen = 0.5f;
public static final void setVoiceListenVolume(float f) {
volumeListen = f;
}
public static final float getVoiceListenVolume() {
return volumeListen;
}
private static float volumeSpeak = 0.5f;
public static final void setVoiceSpeakVolume(float f) {
volumeSpeak = f;
}
public static final float getVoiceSpeakVolume() {
return volumeSpeak;
}
private static final Set<String> emptySet = new HashSet();
public static final Set<String> getVoiceListening() {
return emptySet;
}
public static final Set<String> getVoiceSpeaking() {
return emptySet;
}
public static final void setVoiceMuted(String username, boolean mute) {
}
public static final Set<String> getVoiceMuted() {
return emptySet;
}
private static final List<String> emptyList = new ArrayList();
public static final List<String> getVoiceRecent() {
return emptyList;
}
public static final void tickVoice() {
}
public static final void doJavascriptCoroutines() {

View File

@ -4,7 +4,7 @@ public class ConfigConstants {
public static boolean profanity = false;
public static final String version = "22w26b";
public static final String version = "22w29a";
public static final String mainMenuString = "eaglercraft " + version;
public static final String forkMe = "https://github.com/LAX1DUDE/eaglercraft";

View File

@ -65,6 +65,16 @@ public class GuiVoiceMenu extends GuiScreen {
protected GuiButton applyRadiusButton = null;
protected GuiButton applyVolumeButton = null;
protected GuiButton noticeContinueButton = null;
protected GuiButton noticeCancelButton = null;
protected static boolean showingCompatWarning = false;
protected static boolean showCompatWarning = true;
protected static boolean showingTrackingWarning = false;
protected static boolean showTrackingWarning = true;
protected static Voice.VoiceChannel continueChannel = null;
public GuiVoiceMenu(GuiScreen parent) {
this.parent = parent;
@ -93,7 +103,9 @@ public class GuiVoiceMenu extends GuiScreen {
this.buttonList.clear();
this.buttonList.add(applyRadiusButton = new GuiButton(2, (width - 150) / 2, height / 3 + 49, 150, 20, ts.translateKey("voice.apply")));
this.buttonList.add(applyVolumeButton = new GuiButton(3, (width - 150) / 2, height / 3 + 90, 150, 20, ts.translateKey("voice.apply")));
applyRadiusButton.drawButton = applyVolumeButton.drawButton = false;
this.buttonList.add(noticeContinueButton = new GuiButton(5, (width - 150) / 2, height / 3 + 60, 150, 20, ts.translateKey("voice.unsupportedWarning10")));
this.buttonList.add(noticeCancelButton = new GuiButton(6, (width - 150) / 2, height / 3 + 90, 150, 20, ts.translateKey("voice.unsupportedWarning11")));
applyRadiusButton.drawButton = applyVolumeButton.drawButton = noticeContinueButton.drawButton = noticeCancelButton.drawButton = false;
}
private static final TextureLocation voiceGuiIcons = new TextureLocation("/gui/voice.png");
@ -425,7 +437,75 @@ public class GuiVoiceMenu extends GuiScreen {
EaglerAdapter.glPopMatrix();
if(showingCompatWarning) {
drawNotice(ts.translateKey("voice.unsupportedWarning1"), false, ts.translateKey("voice.unsupportedWarning2"), ts.translateKey("voice.unsupportedWarning3"),
"", ts.translateKey("voice.unsupportedWarning4"), ts.translateKey("voice.unsupportedWarning5"), ts.translateKey("voice.unsupportedWarning6"),
ts.translateKey("voice.unsupportedWarning7"), ts.translateKey("voice.unsupportedWarning8"), ts.translateKey("voice.unsupportedWarning9"));
noticeContinueButton.drawButton = true;
noticeCancelButton.drawButton = false;
}else if(showingTrackingWarning) {
drawNotice(ts.translateKey("voice.ipGrabWarning1"), true, ts.translateKey("voice.ipGrabWarning2"), ts.translateKey("voice.ipGrabWarning3"),
ts.translateKey("voice.ipGrabWarning4"), "", ts.translateKey("voice.ipGrabWarning5"), ts.translateKey("voice.ipGrabWarning6"),
ts.translateKey("voice.ipGrabWarning7"), ts.translateKey("voice.ipGrabWarning8"), ts.translateKey("voice.ipGrabWarning9"),
ts.translateKey("voice.ipGrabWarning10"), ts.translateKey("voice.ipGrabWarning11"), ts.translateKey("voice.ipGrabWarning12"));
noticeContinueButton.drawButton = true;
noticeCancelButton.drawButton = true;
}else {
noticeContinueButton.drawButton = false;
noticeCancelButton.drawButton = false;
}
super.drawScreen(mx, my, partialTicks);
if(showingCompatWarning || showingTrackingWarning) {
throw new AbortedException();
}
}
private void drawNotice(String title, boolean showCancel, String... lines) {
int widthAccum = 0;
for(int i = 0; i < lines.length; ++i) {
int w = fontRenderer.getStringWidth(lines[i]);
if(widthAccum < w) {
widthAccum = w;
}
}
int margin = 15;
int x = (width - widthAccum) / 2;
int y = (height - lines.length * 10 - 60 - margin) / 2;
drawRect(x - margin - 1, y - margin - 1, x + widthAccum + margin + 1,
y + lines.length * 10 + 49 + margin, 0xFFCCCCCC);
drawRect(x - margin, y - margin, x + widthAccum + margin,
y + lines.length * 10 + 48 + margin, 0xFF111111);
drawCenteredString(fontRenderer, EnumChatFormatting.BOLD + title, width / 2, y, 0xFF7766);
for(int i = 0; i < lines.length; ++i) {
drawString(fontRenderer, lines[i], x, y + i * 10 + 18, 0xDDAAAA);
}
if(!showCancel) {
noticeContinueButton.width = 150;
noticeContinueButton.xPosition = (width - 150) / 2;
noticeContinueButton.yPosition = y + lines.length * 10 + 29;
}else {
noticeContinueButton.width = widthAccum / 2 - 10;
noticeContinueButton.xPosition = (width - widthAccum) / 2 + widthAccum / 2 + 3;
noticeContinueButton.yPosition = y + lines.length * 10 + 28;
noticeCancelButton.width = widthAccum / 2 - 10;
noticeCancelButton.xPosition = (width - widthAccum) / 2 + 4;
noticeCancelButton.yPosition = y + lines.length * 10 + 28;
}
}
public static int attenuate(int cin, float f) {
@ -495,7 +575,7 @@ public class GuiVoiceMenu extends GuiScreen {
}
public void mouseClicked(int mx, int my, int button) {
if(showSliderBlocks || showSliderVolume || showPTTKeyConfig) {
if(showSliderBlocks || showSliderVolume || showPTTKeyConfig || showingCompatWarning || showingTrackingWarning) {
if(showSliderBlocks) {
sliderBlocks.mousePressed(mc, mx, my);
}else if(showSliderVolume) {
@ -517,11 +597,34 @@ public class GuiVoiceMenu extends GuiScreen {
this.mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
}else if(mx >= voiceScreenButtonRADIUSposX && my >= voiceScreenButtonRADIUSposY && mx < voiceScreenButtonRADIUSposX +
voiceScreenButtonRADIUSposW && my < voiceScreenButtonRADIUSposY + voiceScreenButtonRADIUSposH) {
if(showCompatWarning) {
continueChannel = Voice.VoiceChannel.PROXIMITY;
showingCompatWarning = true;
}else if(showTrackingWarning) {
continueChannel = Voice.VoiceChannel.PROXIMITY;
showingTrackingWarning = true;
}else {
EaglerAdapter.enableVoice(Voice.VoiceChannel.PROXIMITY);
}
this.mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
}else if(mx >= voiceScreenButtonGLOBALposX && my >= voiceScreenButtonGLOBALposY && mx < voiceScreenButtonGLOBALposX +
voiceScreenButtonGLOBALposW && my < voiceScreenButtonGLOBALposY + voiceScreenButtonGLOBALposH) {
if(showCompatWarning) {
continueChannel = Voice.VoiceChannel.GLOBAL;
showingCompatWarning = true;
}else if(showTrackingWarning) {
continueChannel = Voice.VoiceChannel.GLOBAL;
showingTrackingWarning = true;
}else {
EaglerAdapter.enableVoice(Voice.VoiceChannel.GLOBAL);
}
this.mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
this.mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
}else if(channel == Voice.VoiceChannel.PROXIMITY && status == Voice.VoiceStatus.CONNECTED && mx >= voiceScreenButtonChangeRadiusposX &&
my >= voiceScreenButtonChangeRadiusposY && mx < voiceScreenButtonChangeRadiusposX + voiceScreenButtonChangeRadiusposW &&
@ -575,6 +678,25 @@ public class GuiVoiceMenu extends GuiScreen {
}else if(btn.id == 4) {
showPTTKeyConfig = false;
mc.gameSettings.saveOptions();
}else if(btn.id == 5) {
if(showingCompatWarning) {
showingCompatWarning = false;
showCompatWarning = false;
if(showTrackingWarning) {
showingTrackingWarning = true;
}else {
EaglerAdapter.enableVoice(continueChannel);
}
}else if(showingTrackingWarning) {
showingTrackingWarning = false;
showTrackingWarning = false;
EaglerAdapter.enableVoice(continueChannel);
}
}else if(btn.id == 6) {
if(showingTrackingWarning) {
showingTrackingWarning = false;
EaglerAdapter.enableVoice(Voice.VoiceChannel.NONE);
}
}
}
@ -589,7 +711,7 @@ public class GuiVoiceMenu extends GuiScreen {
}
public boolean isBlockingInput() {
return showSliderBlocks || showSliderVolume || showPTTKeyConfig;
return showSliderBlocks || showSliderVolume || showPTTKeyConfig || showingCompatWarning || showingTrackingWarning;
}
}

View File

@ -6,10 +6,10 @@ import net.lax1dude.eaglercraft.TextureLocation;
public class GuiButton extends Gui {
/** Button width in pixels */
protected int width;
public int width;
/** Button height in pixels */
protected int height;
public int height;
/** The x position of this control. */
public int xPosition;

View File

@ -385,9 +385,9 @@ public abstract class RenderLiving extends Render {
if(renderType == 19) {
EaglerAdapter.glTranslatef(0.0F, -32.0f, 0.0F);
}else if(DefaultSkinRenderer.isHighPoly(renderType) && Minecraft.getMinecraft().gameSettings.allowFNAWSkins) {
EaglerAdapter.glTranslatef(0.0F, 7.0f, 0.0F);
EaglerAdapter.glTranslatef(0.0F, 2.0f, 0.0F);
if(renderType == 37) {
EaglerAdapter.glTranslatef(0.0F, 28.0f, 0.0F);
EaglerAdapter.glTranslatef(0.0F, 30.0f, 0.0F);
}
}
}else {
@ -513,7 +513,7 @@ public abstract class RenderLiving extends Render {
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
EaglerAdapter.glPushMatrix();
EaglerAdapter.glTranslatef(-8.0f, -18.0f, 0.0f);
EaglerAdapter.glTranslatef(-8.0f, -18.0f + var16, 0.0f);
EaglerAdapter.glScalef(16.0f, 16.0f, 16.0f);