Patch bug with global voice and large amounts of nearby players

This commit is contained in:
ayunami2000 2022-07-26 14:43:47 -04:00
parent e24a5981b8
commit 87c08b886d
4 changed files with 45451 additions and 45604 deletions
javascript
src
main/java/net/minecraft/client
teavm/java/net/lax1dude/eaglercraft/adapter

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -1190,15 +1190,11 @@ public class Minecraft implements Runnable {
int prox = 22;
// cube
if (Math.abs(thePlayer.posX - player.posX) <= prox && Math.abs(thePlayer.posY - player.posY) <= prox && Math.abs(thePlayer.posZ - player.posZ) <= prox) {
if (EaglerAdapter.getVoiceChannel() == Voice.VoiceChannel.PROXIMITY) {
EaglerAdapter.addNearbyPlayer(player.username);
seenPlayers.add(player.username);
} else if (EaglerAdapter.getVoiceChannel() == Voice.VoiceChannel.GLOBAL) {
EaglerAdapter.sendVoiceRequestIfNeeded(player.username);
}
EaglerAdapter.addNearbyPlayer(player.username);
seenPlayers.add(player.username);
}
}
if (EaglerAdapter.getVoiceChannel() == Voice.VoiceChannel.PROXIMITY) EaglerAdapter.cleanupNearbyPlayers(seenPlayers);
EaglerAdapter.cleanupNearbyPlayers(seenPlayers);
}
}

@ -2219,8 +2219,7 @@ public class EaglerAdapterImpl2 {
public static final void addNearbyPlayer(String username) {
recentlyNearbyPlayers.remove(username);
if (nearbyPlayers.add(username)) {
if (getVoiceStatus() == Voice.VoiceStatus.DISCONNECTED || getVoiceStatus() == Voice.VoiceStatus.UNAVAILABLE) return;
sendVoiceRequest(username);
sendVoiceRequestIfNeeded(username);
}
}
@ -2234,7 +2233,7 @@ public class EaglerAdapterImpl2 {
} catch (IOException ignored) { }
}
public static final void sendVoiceRequestIfNeeded(String username) {
private static final void sendVoiceRequestIfNeeded(String username) {
if (getVoiceStatus() == Voice.VoiceStatus.DISCONNECTED || getVoiceStatus() == Voice.VoiceStatus.UNAVAILABLE) return;
if (!voiceGains.containsKey(username)) sendVoiceRequest(username);
}
@ -2249,7 +2248,7 @@ public class EaglerAdapterImpl2 {
public static final void removeNearbyPlayer(String username) {
if (nearbyPlayers.remove(username)) {
if (getVoiceStatus() == Voice.VoiceStatus.DISCONNECTED || getVoiceStatus() == Voice.VoiceStatus.UNAVAILABLE) return;
recentlyNearbyPlayers.add(username);
if (enabledChannel == Voice.VoiceChannel.PROXIMITY) recentlyNearbyPlayers.add(username);
}
}