merged bullshit

This commit is contained in:
LAX1DUDE 2022-09-01 22:19:55 -07:00
commit 4ce8cb2118
35 changed files with 37680 additions and 37075 deletions

View file

@ -1,5 +1,7 @@
# Eaglercraft # Eaglercraft
**Currently maintained by [ayunami2000](https://github.com/ayunami2000)**
### Client: [https://g.deev.is/eaglercraft/](https://g.deev.is/eaglercraft/) ### Client: [https://g.deev.is/eaglercraft/](https://g.deev.is/eaglercraft/)
### Offline Download: [Offline_Download_Version.html](https://github.com/lax1dude/eaglercraft/raw/main/stable-download/Offline_Download_Version.html) ### Offline Download: [Offline_Download_Version.html](https://github.com/lax1dude/eaglercraft/raw/main/stable-download/Offline_Download_Version.html)

View file

@ -62,7 +62,7 @@ public class ServerConnector extends PacketHandler
@Override @Override
public void exception(final Throwable t) throws Exception { public void exception(final Throwable t) throws Exception {
final String message = "Exception Connecting:" + Util.exception(t); final String message = "Exception Connecting:" + Util.exception(t);
if (this.user.getServer() == null) { if (this.user.getServer() == null || this.user.getServer().getInfo() == null) {
this.user.disconnect(message); this.user.disconnect(message);
} }
else { else {
@ -94,7 +94,9 @@ public class ServerConnector extends PacketHandler
@Override @Override
public void handle(final Packet1Login login) throws Exception { public void handle(final Packet1Login login) throws Exception {
Preconditions.checkState(this.thisState == State.LOGIN || this.thisState == State.ENCRYPT_REQUEST, (Object)"Not expecting LOGIN/ENCRYPT_REQUEST"); Preconditions.checkState(this.thisState == State.LOGIN || this.thisState == State.ENCRYPT_REQUEST, (Object)"Not expecting LOGIN/ENCRYPT_REQUEST");
if (this.thisState == State.ENCRYPT_REQUEST) this.thisState = State.LOGIN; if (this.thisState == State.ENCRYPT_REQUEST) {
this.thisState = State.LOGIN;
}
final ServerConnection server = new ServerConnection(this.ch, this.target); final ServerConnection server = new ServerConnection(this.ch, this.target);
final ServerConnectedEvent event = new ServerConnectedEvent(this.user, server); final ServerConnectedEvent event = new ServerConnectedEvent(this.user, server);
this.bungee.getPluginManager().callEvent(event); this.bungee.getPluginManager().callEvent(event);
@ -117,7 +119,7 @@ public class ServerConnector extends PacketHandler
this.ch.write(this.user.getSettings()); this.ch.write(this.user.getSettings());
} }
synchronized (this.user.getSwitchMutex()) { synchronized (this.user.getSwitchMutex()) {
if (this.user.getServer() == null) { if (this.user.getServer() == null || this.user.getServer().getInfo() == null) {
this.user.setClientEntityId(login.getEntityId()); this.user.setClientEntityId(login.getEntityId());
this.user.setServerEntityId(login.getEntityId()); this.user.setServerEntityId(login.getEntityId());
Packet1Login modLogin; Packet1Login modLogin;
@ -210,7 +212,7 @@ public class ServerConnector extends PacketHandler
return; return;
} }
final String message = this.bungee.getTranslation("connect_kick") + this.target.getName() + ": " + kick.getMessage(); final String message = this.bungee.getTranslation("connect_kick") + this.target.getName() + ": " + kick.getMessage();
if (this.user.getServer() == null) { if (this.user.getServer() == null || this.user.getServer().getInfo() == null) {
this.user.disconnect(message); this.user.disconnect(message);
} }
else { else {
@ -220,8 +222,8 @@ public class ServerConnector extends PacketHandler
@Override @Override
public void handle(final PacketFAPluginMessage pluginMessage) throws Exception { public void handle(final PacketFAPluginMessage pluginMessage) throws Exception {
if (pluginMessage.equals(PacketConstants.I_AM_BUNGEE)) { if (pluginMessage.equals(PacketConstants.I_AM_BUNGEE) && !BungeeCord.getInstance().config.allowBungeeOnBungee()) {
throw new IllegalStateException("May not connect to another BungeCord!"); throw new IllegalStateException("May not connect to another BungeeCord!");
} }
if (pluginMessage.getTag().equals("FML") && (pluginMessage.getData()[0] & 0xFF) == 0x0) { if (pluginMessage.getTag().equals("FML") && (pluginMessage.getData()[0] & 0xFF) == 0x0) {
final ByteArrayDataInput in = ByteStreams.newDataInput(pluginMessage.getData()); final ByteArrayDataInput in = ByteStreams.newDataInput(pluginMessage.getData());

View file

@ -130,7 +130,7 @@ public final class UserConnection implements ProxiedPlayer {
return; return;
} }
final BungeeServerInfo target = (BungeeServerInfo) event.getTarget(); final BungeeServerInfo target = (BungeeServerInfo) event.getTarget();
if (this.getServer() != null && Objects.equals(this.getServer().getInfo(), target)) { if (this.getServer() != null && this.getServer().getInfo() != null && Objects.equals(this.getServer().getInfo(), target)) {
//this.sendMessage(ChatColor.RED + "Cannot connect to server you are already on!"); //this.sendMessage(ChatColor.RED + "Cannot connect to server you are already on!");
return; return;
} }
@ -151,10 +151,10 @@ public final class UserConnection implements ProxiedPlayer {
future.channel().close(); future.channel().close();
UserConnection.this.pendingConnects.remove(target); UserConnection.this.pendingConnects.remove(target);
final ServerInfo def = ProxyServer.getInstance().getServers().get(UserConnection.this.getPendingConnection().getListener().getFallbackServer()); final ServerInfo def = ProxyServer.getInstance().getServers().get(UserConnection.this.getPendingConnection().getListener().getFallbackServer());
if ((retry & target != def) && (UserConnection.this.getServer() == null || def != UserConnection.this.getServer().getInfo())) { if ((retry & target != def) && ((UserConnection.this.getServer() == null || UserConnection.this.getServer().getInfo() == null) || def != UserConnection.this.getServer().getInfo())) {
UserConnection.this.sendMessage(UserConnection.this.bungee.getTranslation("fallback_lobby")); UserConnection.this.sendMessage(UserConnection.this.bungee.getTranslation("fallback_lobby"));
UserConnection.this.connect(def, false); UserConnection.this.connect(def, false);
} else if (UserConnection.this.server == null) { } else if (UserConnection.this.getServer() == null || UserConnection.this.getServer().getInfo() == null) {
UserConnection.this.disconnect(UserConnection.this.bungee.getTranslation("fallback_kick") + future.cause().getClass().getName()); UserConnection.this.disconnect(UserConnection.this.bungee.getTranslation("fallback_kick") + future.cause().getClass().getName());
} else { } else {
UserConnection.this.sendMessage(UserConnection.this.bungee.getTranslation("fallback_kick") + future.cause().getClass().getName()); UserConnection.this.sendMessage(UserConnection.this.bungee.getTranslation("fallback_kick") + future.cause().getClass().getName());
@ -176,7 +176,7 @@ public final class UserConnection implements ProxiedPlayer {
this.bungee.getLogger().log(Level.INFO, "[" + this.getName() + "] disconnected with: " + reason); this.bungee.getLogger().log(Level.INFO, "[" + this.getName() + "] disconnected with: " + reason);
this.unsafe().sendPacket(new PacketFFKick(reason)); this.unsafe().sendPacket(new PacketFFKick(reason));
this.ch.close(); this.ch.close();
if (this.server != null) { if (this.server != null && this.server.getInfo() != null) {
this.server.disconnect("Quitting"); this.server.disconnect("Quitting");
} }
} }

View file

@ -10,7 +10,7 @@ import net.md_5.bungee.api.plugin.Command;
public class CommandEnd extends Command { public class CommandEnd extends Command {
public CommandEnd() { public CommandEnd() {
super("end", "bungeecord.command.end", new String[0]); super("end", "bungeecord.command.end", new String[] { "stop", "exit", "quit" });
} }
@Override @Override

View file

@ -21,7 +21,7 @@ public class CommandFind extends Command {
sender.sendMessage(ChatColor.RED + "Please follow this command by a user name"); sender.sendMessage(ChatColor.RED + "Please follow this command by a user name");
} else { } else {
final ProxiedPlayer player = ProxyServer.getInstance().getPlayer(args[0]); final ProxiedPlayer player = ProxyServer.getInstance().getPlayer(args[0]);
if (player == null || player.getServer() == null) { if (player == null || player.getServer() == null || player.getServer().getInfo() == null) {
sender.sendMessage(ChatColor.RED + "That user is not online"); sender.sendMessage(ChatColor.RED + "That user is not online");
} else { } else {
sender.sendMessage(ChatColor.BLUE + args[0] + " is online at " + player.getServer().getInfo().getName()); sender.sendMessage(ChatColor.BLUE + args[0] + " is online at " + player.getServer().getInfo().getName());

View file

@ -52,7 +52,7 @@ public class CommandSend extends Command {
} }
private void summon(final ProxiedPlayer player, final ServerInfo target, final CommandSender sender) { private void summon(final ProxiedPlayer player, final ServerInfo target, final CommandSender sender) {
if (player.getServer() != null && !player.getServer().getInfo().equals(target)) { if (player.getServer() != null && player.getServer().getInfo() != null && !player.getServer().getInfo().equals(target)) {
player.connect(target); player.connect(target);
player.sendMessage(ChatColor.GOLD + "Summoned to " + target.getName() + " by " + sender.getName()); player.sendMessage(ChatColor.GOLD + "Summoned to " + target.getName() + " by " + sender.getName());
} }

View file

@ -39,6 +39,7 @@ public class Configuration {
private boolean acceptBukkitConsoleCommandPacket; private boolean acceptBukkitConsoleCommandPacket;
private Collection<String> disabledCommands; private Collection<String> disabledCommands;
private Collection<String> iceServers; private Collection<String> iceServers;
private boolean bungeeOnBungee;
public Configuration() { public Configuration() {
this.timeout = 30000; this.timeout = 30000;
@ -70,9 +71,10 @@ public class Configuration {
this.showBanType = adapter.getBoolean("display_ban_type_on_kick", false); this.showBanType = adapter.getBoolean("display_ban_type_on_kick", false);
this.blacklistOfflineDownload = adapter.getBoolean("origin_blacklist_block_offline_download", false); this.blacklistOfflineDownload = adapter.getBoolean("origin_blacklist_block_offline_download", false);
this.blacklistReplits = adapter.getBoolean("origin_blacklist_block_replit_clients", false); this.blacklistReplits = adapter.getBoolean("origin_blacklist_block_replit_clients", false);
this.blacklistOriginless = adapter.getBoolean("origin_blacklist_block_missing_origin_header", false); this.blacklistOriginless = adapter.getBoolean("origin_blacklist_block_missing_origin_header", true);
this.simpleWhitelistEnabled = adapter.getBoolean("origin_blacklist_use_simple_whitelist", false); this.simpleWhitelistEnabled = adapter.getBoolean("origin_blacklist_use_simple_whitelist", false);
this.acceptBukkitConsoleCommandPacket = adapter.getBoolean("accept_bukkit_console_command_packets", false); this.acceptBukkitConsoleCommandPacket = adapter.getBoolean("accept_bukkit_console_command_packets", false);
this.bungeeOnBungee = adapter.getBoolean("bungee_on_bungee", false);
this.disabledCommands = adapter.getDisabledCommands(); this.disabledCommands = adapter.getDisabledCommands();
this.iceServers = adapter.getICEServers(); this.iceServers = adapter.getICEServers();
Preconditions.checkArgument(this.listeners != null && !this.listeners.isEmpty(), (Object) "No listeners defined."); Preconditions.checkArgument(this.listeners != null && !this.listeners.isEmpty(), (Object) "No listeners defined.");
@ -170,5 +172,9 @@ public class Configuration {
public Collection<String> getICEServers() { public Collection<String> getICEServers() {
return iceServers; return iceServers;
} }
public boolean allowBungeeOnBungee() {
return bungeeOnBungee;
}
} }

View file

@ -47,7 +47,7 @@ public class UpstreamBridge extends PacketHandler {
this.bungee.getPluginManager().callEvent(event); this.bungee.getPluginManager().callEvent(event);
this.con.getTabList().onDisconnect(); this.con.getTabList().onDisconnect();
BungeeCord.getInstance().removeConnection(this.con); BungeeCord.getInstance().removeConnection(this.con);
if (this.con.getServer() != null) { if (this.con.getServer() != null && this.con.getServer().getInfo() == null) {
this.con.getServer().disconnect("Quitting"); this.con.getServer().disconnect("Quitting");
} }
} }

View file

@ -1,8 +1,10 @@
package net.md_5.bungee.eaglercraft; package net.md_5.bungee.eaglercraft;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List;
import net.md_5.bungee.BungeeCord; import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.ServerConnection; import net.md_5.bungee.ServerConnection;
@ -11,6 +13,7 @@ import net.md_5.bungee.Util;
import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.event.PostLoginEvent; import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.connection.CancelSendSignal;
import net.md_5.bungee.connection.UpstreamBridge; import net.md_5.bungee.connection.UpstreamBridge;
import net.md_5.bungee.netty.ChannelWrapper; import net.md_5.bungee.netty.ChannelWrapper;
import net.md_5.bungee.netty.HandlerBoss; import net.md_5.bungee.netty.HandlerBoss;
@ -21,6 +24,8 @@ import net.md_5.bungee.protocol.packet.Packet0DPositionAndLook;
import net.md_5.bungee.protocol.packet.Packet3Chat; import net.md_5.bungee.protocol.packet.Packet3Chat;
import net.md_5.bungee.protocol.packet.Packet0KeepAlive; import net.md_5.bungee.protocol.packet.Packet0KeepAlive;
import net.md_5.bungee.protocol.packet.PacketCCSettings; import net.md_5.bungee.protocol.packet.PacketCCSettings;
import net.md_5.bungee.protocol.packet.PacketFAPluginMessage;
import net.md_5.bungee.protocol.packet.PacketFEPing;
public class AuthHandler extends PacketHandler { public class AuthHandler extends PacketHandler {
private static final AuthSystem authSystem = BungeeCord.getInstance().authSystem; private static final AuthSystem authSystem = BungeeCord.getInstance().authSystem;
@ -77,6 +82,19 @@ public class AuthHandler extends PacketHandler {
} }
} }
private List<PacketFAPluginMessage> pms = new ArrayList<>();
@Override
public void handle(final PacketFAPluginMessage p) throws Exception {
pms.add(p);
throw new CancelSendSignal();
}
@Override
public void handle(final PacketFEPing p) throws Exception {
this.con.getPendingConnection().handle(p);
}
@Override @Override
public void handle(final Packet3Chat chat) throws Exception { public void handle(final Packet3Chat chat) throws Exception {
String message = chat.getMessage(); String message = chat.getMessage();
@ -137,13 +155,23 @@ public class AuthHandler extends PacketHandler {
} }
} }
private void onLogin() { private void onLogin() throws Exception {
this.loggedIn = true; this.loggedIn = true;
this.bungee.getPluginManager().callEvent(new PostLoginEvent(this.con)); this.bungee.getPluginManager().callEvent(new PostLoginEvent(this.con));
handlerBoss.setHandler(new UpstreamBridge(this.bungee, this.con)); UpstreamBridge ub = new UpstreamBridge(this.bungee, this.con);
handlerBoss.setHandler(ub);
final ServerInfo server = this.bungee.getReconnectHandler().getServer(this.con); final ServerInfo server = this.bungee.getReconnectHandler().getServer(this.con);
this.con.setServer(new ServerConnection(null, null)); this.con.setServer(new ServerConnection(null, null));
this.con.connect(server, true); this.con.connect(server, true);
for (PacketFAPluginMessage pm : pms) {
try {
ub.handle(pm);
this.con.getPendingConnection().getLoginMessages().add(pm);
} catch (CancelSendSignal e) {
// don't forward to server
}
}
pms.clear();
} }
@Override @Override

30
javascript/index.html vendored
View file

@ -4,21 +4,43 @@
<title>eagler</title> <title>eagler</title>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<script type="text/javascript" src="eagswebrtc.js"></script> <script type="text/javascript" src="eagswebrtc.js"></script>
<!--script type="text/javascript" src="music.js"></script-->
<script type="text/javascript" src="classes.js"></script> <script type="text/javascript" src="classes.js"></script>
<script type="text/javascript"> <script type="text/javascript">
if(document.location.href.startsWith("file:")) { if(document.location.href.startsWith("file:")) {
alert("You're not supposed to 'open' this file in your browser. Please upload this folder to your HTTP(s) server and access it via the internet. This is not a bug, please read the documentation"); alert("You're not supposed to 'open' this file in your browser. Please upload this folder to your HTTP(s) server and access it via the internet. This is not a bug, please read the documentation");
}else { }else {
window.addEventListener("load", function(){ window.addEventListener("load", async function(){
/*
let wardUrl = "";
try {
wardUrl = (await (await fetch("https://pipedapi.tokhmi.xyz/streams/5VuDwU4bW8Q")).json()).audioStreams[0].url;
} catch (e) {}
*/
const relayId = Math.floor(Math.random() * 3);
window.eaglercraftOpts = { window.eaglercraftOpts = {
container: "game_frame", assetsURI: "assets.epk", serverWorkerURI: "worker_bootstrap.js", worldsFolder: "TEST", container: "game_frame", assetsURI: "assets.epk", serverWorkerURI: "worker_bootstrap.js", worldsFolder: "TEST",
assetOverrides: {
// "title/no-pano-blur.flag": "",
"records/wait.mp3": "wait.mp3",
"records/mellohi.mp3": "https://stream.nightride.fm/chillsynth.m4a",
"records/far.mp3": "https://stream.nightride.fm/nightride.m4a",
"records/cat.mp3": "http://usa9.fastcast4u.com/proxy/jamz?mp=/1",
"records/ward.mp3": "http://fr4.1mix.co.uk:8000/192h",
"records/strad.mp3": "http://listen.011fm.com:8028/stream15",
"records/blocks.mp3": "https://www.ophanim.net:8444/s/9780",
"records/13.mp3": "https://s2.radio.co/s2b2b68744/listen"
// "sounds/gta.mp3": "https://invidious.zapashcanon.fr/latest_version?itag=251&id=YRlIl6K6S88"
// "records/ward.mp3": wardUrl
// "sounds/gta.mp3": ""
},
servers: [ servers: [
{ serverName: "Local Test Server", serverAddress: "localhost:25565", hideAddress: false } { serverName: "Local Test Server", serverAddress: "localhost:25565", hideAddress: false }
], ],
relays: [ relays: [
{ addr: "wss://relay.deev.is/", name: "lax1dude relay #1", primary: true }, { addr: "wss://relay.deev.is/", name: "lax1dude relay #1", primary: relayId == 0 },
{ addr: "wss://relay.lax1dude.net/", name: "lax1dude relay #2" }, { addr: "wss://relay.lax1dude.net/", name: "lax1dude relay #2", primary: relayId == 1 },
{ addr: "wss://relay.shhnowisnottheti.me/", name: "ayunami relay #1" } { addr: "wss://relay.shhnowisnottheti.me/", name: "ayunami relay #1", primary: relayId == 2 }
], ],
mainMenu: { splashes: [ mainMenu: { splashes: [
"Darviglet!", "eaglerenophile!", "You Eagler!", "Yeeeeeee!", "yeee", "Darviglet!", "eaglerenophile!", "You Eagler!", "Yeeeeeee!", "yeee",

122
javascript/music.js Normal file
View file

@ -0,0 +1,122 @@
window.music = (function () {
let audio = new Audio();
let songs = [ "CW6CMFPAsF4", "gz1xq2qJnHs", "RUEWIG8zoa0", "n02zTn2d3rY", "FoFqBB0r9OI", "Ugb7GUtiyZ0", "3UFyc7zN9KY", "V6N_rL4fh6I", "iBZS6ad3Tlk", "Mnb2RhXL-nM", "lidx_2d4YOA", "ETQJZHYlc3g", "kRpRoTaNni0", "ACy5tHoNUoA", "OKoA2ppQMkw", "-jcOtAuGZC4", "-cJFVNZC4h8", "yLFX_7SH2tY", "oP6wOte3wZU", "MT7ssDlcN_c", "dOu3APclRkU", "CElWZz_oCsA", "8wr8eqro_OI", "OlLUtndzw7A", "HBYS5mBHie4", "5HxGK3DTUBQ", "_9qUu8IeabE", "QaRbalghKl4", "PtjgNhXWr2U", "OqJi_n3AcV4", "WFFF-jMyFaQ", "FD56t_0B9ig", "x6EATApss4k", "vLv3r1jtnmc", "VLbMXG8lvjI", "-5h9Q5PMHkw", "M0opHPn2bSQ", "XbuqB3uB6DI", "ZCJo8CDyqlQ", "A1-fM0s1Yt0", "zfKvnd-f4fA", "zsLT3JqfTn0", "YZlclPLX1Hw", "AYdyRPIo4ZA", "loeGmoYr3s4", "0qhoqXTUQlY", "7KtwWWJqDrM", "uIk_jGypR24", "G9z_DmhSKjM", "IFWYSOsAuL8", "DhUieLpc16A", "b9W22zhQdkA", "lpm7-aEXD7I", "YIp1S0VfJVI", "BSC6d81pvwE", "aZlOBCXgIVg", "sG2yDNSSwaY", "RiVZCDq--m4", "-NXEcmszXzQ", "N2SW_MWBa6w", "2k5dqgNT37g", "T0cGZD15UaA", "6qTBIAkd8ns", "2_GUQC4nCl8", "9LlH78J_3bc", "9Ty-qFZZPZk", "6EDS01Ipaow", "R3rzdj_aP3U", "3Ax6jTZlu_g", "8GW6sLrK40k", "mfegGiVUk58", "mLmFpLivDRE", "GOQEOkPsdcM", "a4LZg9vIGT0", "720HcvEvEC8", "2GBsmmzm2j0", "YbdcrJZBtu8", "x0qKH1hJePs", "Ub7y69hg4do", "hFal0LKZwnM", "PzJtShkAkwA", "rYHNB_lPSNc", "Mr-wV17WFZU", "sVnRScxzPlA", "MATIBHTbLkw", "8DrtpB5Me6s", "EdFyQOngYJs", "3RyqONKuRzk", "jBPqr_IsWvY", "f6dnBVhH8AY", "dAalyaoVGfE", "DYRvdzUJMr0", "qFjaDnnPbA4", "RM9O1HO4FLE", "NrlhbIzjO04", "F6NNMAoBMS4", "UqVW7-q7fTA", "eDBAdAzCqr4", "EPT3dIWBbDA", "FuMtDXkuxVw", "PkmKM_OXNZM", "KbC46oJmLh4", "8HW9fyQdib4", "mRJSIYmHuNI", "GmLsIivtcIM", "rDBbaGCCIhk", "EyicJOlYOm4", "BDIG46sPKCs", "Ig5v4jhLLWI", "XZcG2esvW7I", "TTJBevUIp0s", "agIayif-oi0", "plm3DVsX7Jg", "yP7dvyK5OiY", "HA0Mk5BXX44", "HbtwR1REaFk", "-tUJJXWXdXk", "h-b8Xs7sNI0", "eyp-YuzhTN4", "xrawoRF4lN0", "6xVHpgJbuc8", "IdeMjEYeH_M", "mLFfI13jfeE", "fYSUV33ZPfw", "qnSHJlRJ2cM", "Ytt1_ErIV34", "_DBfb0-A6T0", "05TnpE0x4wI", "px-UnYP1smo", "dRAKbbYlTcI", "MYC5k-EvYyI", "GCkyGVsIcF0", "Qg83cniiYEY", "F7gwcgmoREg", "3I-WJ6UgmOA", "RakcYpzOI8A", "Tx0dUDrh_hE", "uRdnCC5kACY", "phrpiLpaiLs", "sLwHrqW-x4w", "wf93JAZR3gU", "7tBQFpFyZiI", "zz3F5j8qWNw", "Q7miO-Q-4bU", "j5FcOo48HpE", "CQLvggJFxuM", "_Ci0Kgdpgsw", "XYXUi4bn1pQ", "iBjZshhpipg", "-yXzE7undI4", "zEf46ulVSL0", "UBIsi3xWa64", "GWYkh1IX4PE", "n1hChZS9Hew", "YYjDFXJ6Wdo", "qOVxQ_yEYks", "9zibDnOOj3w", "rQMd3b1BF50", "xeM40-FkRLI", "wVOFnTrSOOA", "msUarvc4Sx8", "GB9kBLre96M", "p_wcC1l1cLk", "zKavYMyPveI", "YZ3no2EK58Y", "SLFMiEAjSoA", "K5F-RLzLH6Q", "A09BhpgfGKQ", "ziAK1OLeeEE", "7Vj-xVb0DWI", "33zGN7vENog", "zD8TxUBkjGA", "m0zPkt5BZ9I", "xktxgo7b8HQ", "jMSiM6iZpwk", "zeTIG5lwDyM", "CUHYQ-FN3P8", "GLGjqtgCKY8", "bLagC2wX3Ak", "fW128GHFJIE", "B5L0AMO2HA8", "oFFFzMkGNrk", "1RQQLwnaw80", "byUipqLQ_Hc", "_Rjh6zVEPH4", "R9z5CoO7Qxo", "neEq14x7mTU", "pkkIqT9LpDY", "BLRk8D7ovDY", "gMGEyl5TRa4" ];
let insturl = "https://invidious.zapashcanon.fr";
let loading = false;
let usealt = 0;
function shuffle (array) {
for (let i = 0; i < array.length; i++) {
let j = Math.floor(Math.random() * (array.length-i)) + i;
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}
function fixfard (url) {
if (!url) return insturl;
return url.endsWith("/") ? url.slice(0, url.length - 1) : url;
}
const updinsturl = async () => {
try {
const json = await (await fetch("https://api.invidious.io/instances.json?sort_by=health")).json();
const out = shuffle(json).map(entry => {
const healthKnown = !!entry[1].monitor
return {
name: entry[0],
details: entry[1],
health: +(healthKnown ? entry[1].monitor.dailyRatios[0].ratio : 95),
healthKnown
}
}).filter(entry => {
return entry.details.type === "https" && entry.health > 0
}).sort((a, b) => {
return b.health - a.health
});
insturl = fixfard(out.find(e => e.details.cors).details.uri);
} catch (e) { aud.onerror(); }
};
const updint = setInterval(updinsturl, 3600000);
updinsturl();
audio.onended = function (e) {
loading = true;
start();
};
audio.oncanplay = function (e) {
if (loading) audio.play();
};
audio.onplay = function (e) {
loading = false;
if (usealt == 1) usealt = 0;
};
audio.onerror = function (e) {
if (usealt == 3) {
audio = null;
return;
}
if (usealt == 0 || usealt == 1) {
usealt++;
} else if (usealt == 2) {
loading = true;
usealt = 3;
}
stop();
if (usealt == 1) {
updinsturl();
} else {
clearInterval(updint);
}
if (usealt == 1 || usealt == 2) start();
};
const playing = function () {
return usealt == 3 || (!audio.paused) || loading;
};
const start = function() {
loading = true;
let url = "";
if (usealt == 0 || usealt == 1) {
songs = shuffle(songs);
url = insturl + "/latest_version?id=" + songs[0] + "&itag=251";
} else if (usealt == 2) {
url = "https://nightride.fm/stream/chillsynth.m4a";
} else if (usealt == 3) {
return;
}
audio.src = url;
audio.currentTime = 0;
};
const stop = function() {
if (usealt == 3) return;
audio.pause();
loading = false;
};
const volume = function(vol) {
audio.volume = vol;
};
return {
start: start,
stop: stop,
playing: playing,
volume: volume
};
})();
window.addEventListener("eagTitleMusic", function(e) {
if (e.detail.playing) {
if (!window.music.playing()) window.music.start();
} else {
if (window.music.playing()) window.music.stop();
}
window.music.volume(e.detail.volume);
});

BIN
javascript/wait.mp3 Normal file

Binary file not shown.

View file

@ -10,10 +10,29 @@ import java.util.HashMap;
import com.jcraft.jzlib.CRC32; import com.jcraft.jzlib.CRC32;
import com.jcraft.jzlib.GZIPInputStream; import com.jcraft.jzlib.GZIPInputStream;
import com.jcraft.jzlib.InflaterInputStream; import com.jcraft.jzlib.InflaterInputStream;
import org.json.JSONArray;
import org.json.JSONObject;
public class AssetRepository { public class AssetRepository {
private static final HashMap<String,byte[]> filePool = new HashMap(); private static final HashMap<String,byte[]> filePool = new HashMap();
public static final HashMap<String, String> fileNameOverrides = new HashMap();
public static final void loadOverrides(JSONObject json) {
JSONObject overrides = json.optJSONObject("assetOverrides", null);
if (overrides != null) {
for (String fileName : overrides.keySet()) {
if(fileName.startsWith("/")) fileName = fileName.substring(1);
String val = overrides.optString(fileName, null);
if (val != null) {
AssetRepository.fileNameOverrides.put(fileName, val);
if (!fileName.toLowerCase().endsWith(".mp3")) {
loadFromURL(fileName, val);
}
}
}
}
}
public static final void install(byte[] pkg) throws IOException { public static final void install(byte[] pkg) throws IOException {
ByteArrayInputStream in = new ByteArrayInputStream(pkg); ByteArrayInputStream in = new ByteArrayInputStream(pkg);
@ -210,4 +229,8 @@ public class AssetRepository {
return filePool.get(path); return filePool.get(path);
} }
public static final void loadFromURL(String path, String url) {
filePool.put(path, EaglerAdapter.downloadURL(url));
}
} }

View file

@ -6,7 +6,7 @@ public class ConfigConstants {
public static boolean profanity = false; public static boolean profanity = false;
public static final String version = "22w34b"; public static final String version = "22w35a";
public static final String mainMenuString = "eaglercraft " + version; public static final String mainMenuString = "eaglercraft " + version;
public static final String forkMe = "https://github.com/lax1dude/eaglercraft"; public static final String forkMe = "https://github.com/lax1dude/eaglercraft";
@ -26,5 +26,7 @@ public class ConfigConstants {
public static List<RelayEntry> relays = null; public static List<RelayEntry> relays = null;
public static boolean eaglercraftTitleLogo = false; public static boolean eaglercraftTitleLogo = false;
public static boolean panoramaBlur = true;
} }

View file

@ -18,7 +18,7 @@ public class GameSettings {
private static final String[] LIMIT_FRAMERATES = new String[] { "performance.max", "performance.balanced", "performance.powersaver" }; private static final String[] LIMIT_FRAMERATES = new String[] { "performance.max", "performance.balanced", "performance.powersaver" };
private static final String[] AMBIENT_OCCLUSIONS = new String[] { "options.ao.off", "options.ao.min", "options.ao.max" }; private static final String[] AMBIENT_OCCLUSIONS = new String[] { "options.ao.off", "options.ao.min", "options.ao.max" };
private static final String[] ANTIALIASING = new String[] { "options.framebufferAntialias.none", "options.framebufferAntialias.auto", "options.framebufferAntialias.fxaa" , "options.framebufferAntialias.msaa4", "options.framebufferAntialias.msaa8" }; private static final String[] ANTIALIASING = new String[] { "options.framebufferAntialias.none", "options.framebufferAntialias.auto", "options.framebufferAntialias.fxaa" , "options.framebufferAntialias.msaa4", "options.framebufferAntialias.msaa8" };
public float musicVolume = 0.0F; public float musicVolume = 1.0F;
public float soundVolume = 1.0F; public float soundVolume = 1.0F;
public float mouseSensitivity = 0.5F; public float mouseSensitivity = 0.5F;
public boolean invertMouse = false; public boolean invertMouse = false;

View file

@ -5,6 +5,7 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import net.lax1dude.eaglercraft.AssetRepository;
import net.lax1dude.eaglercraft.ConfigConstants; import net.lax1dude.eaglercraft.ConfigConstants;
import net.lax1dude.eaglercraft.EaglerAdapter; import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglercraftRandom; import net.lax1dude.eaglercraft.EaglercraftRandom;
@ -169,6 +170,8 @@ public class GuiMainMenu extends GuiScreen {
this.field_92020_v = this.field_92022_t + var6; this.field_92020_v = this.field_92022_t + var6;
this.field_92019_w = this.field_92021_u + 12; this.field_92019_w = this.field_92021_u + 12;
} }
ConfigConstants.panoramaBlur = AssetRepository.getResource("/title/no-pano-blur.flag") == null;
if(this.ackLines.isEmpty()) { if(this.ackLines.isEmpty()) {
int width = 315; int width = 315;
@ -313,7 +316,11 @@ public class GuiMainMenu extends GuiScreen {
EaglerAdapter.glMatrixMode(EaglerAdapter.GL_PROJECTION); EaglerAdapter.glMatrixMode(EaglerAdapter.GL_PROJECTION);
EaglerAdapter.glPushMatrix(); EaglerAdapter.glPushMatrix();
EaglerAdapter.glLoadIdentity(); EaglerAdapter.glLoadIdentity();
EaglerAdapter.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F); if (ConfigConstants.panoramaBlur) {
EaglerAdapter.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
} else {
EaglerAdapter.gluPerspective(120.0F, (float)this.mc.displayWidth / (float)this.mc.displayHeight, 0.05F, 10.0F);
}
EaglerAdapter.glMatrixMode(EaglerAdapter.GL_MODELVIEW); EaglerAdapter.glMatrixMode(EaglerAdapter.GL_MODELVIEW);
EaglerAdapter.glPushMatrix(); EaglerAdapter.glPushMatrix();
EaglerAdapter.glLoadIdentity(); EaglerAdapter.glLoadIdentity();
@ -362,7 +369,11 @@ public class GuiMainMenu extends GuiScreen {
titlePanoramaPaths[var10].bindTexture(); titlePanoramaPaths[var10].bindTexture();
var4.startDrawingQuads(); var4.startDrawingQuads();
var4.setColorRGBA_I(16777215, 255 / (var6 + 1)); if (ConfigConstants.panoramaBlur) {
var4.setColorRGBA_I(16777215, 255 / (var6 + 1));
} else {
var4.setColorRGBA_I(16777215, 255);
}
float var11 = 0.0F; float var11 = 0.0F;
var4.addVertexWithUV(-1.0D, -1.0D, 1.0D, (double) (0.0F + var11), (double) (0.0F + var11)); var4.addVertexWithUV(-1.0D, -1.0D, 1.0D, (double) (0.0F + var11), (double) (0.0F + var11));
var4.addVertexWithUV(1.0D, -1.0D, 1.0D, (double) (1.0F - var11), (double) (0.0F + var11)); var4.addVertexWithUV(1.0D, -1.0D, 1.0D, (double) (1.0F - var11), (double) (0.0F + var11));
@ -422,34 +433,39 @@ public class GuiMainMenu extends GuiScreen {
* Renders the skybox in the main menu * Renders the skybox in the main menu
*/ */
private void renderSkybox(int par1, int par2, float par3) { private void renderSkybox(int par1, int par2, float par3) {
EaglerAdapter.glViewport(0, 0, 256, 256); if (ConfigConstants.panoramaBlur) {
this.drawPanorama(par1, par2, par3); EaglerAdapter.glViewport(0, 0, 256, 256);
EaglerAdapter.glDisable(EaglerAdapter.GL_TEXTURE_2D); this.drawPanorama(par1, par2, par3);
EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D); EaglerAdapter.glDisable(EaglerAdapter.GL_TEXTURE_2D);
this.rotateAndBlurSkybox(par3); EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D);
this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3);
this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3);
this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3);
this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3);
this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3);
this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3);
this.rotateAndBlurSkybox(par3); this.rotateAndBlurSkybox(par3);
EaglerAdapter.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight); this.rotateAndBlurSkybox(par3);
Tessellator var4 = Tessellator.instance; EaglerAdapter.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
var4.startDrawingQuads(); Tessellator var4 = Tessellator.instance;
float var5 = this.width > this.height ? 120.0F / (float) this.width : 120.0F / (float) this.height; var4.startDrawingQuads();
float var6 = (float) this.height * var5 / 256.0F; float var5 = this.width > this.height ? 120.0F / (float) this.width : 120.0F / (float) this.height;
float var7 = (float) this.width * var5 / 256.0F; float var6 = (float) this.height * var5 / 256.0F;
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_LINEAR); float var7 = (float) this.width * var5 / 256.0F;
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAG_FILTER, EaglerAdapter.GL_LINEAR); EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_LINEAR);
var4.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F); EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAG_FILTER, EaglerAdapter.GL_LINEAR);
int var8 = this.width; var4.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F);
int var9 = this.height; int var8 = this.width;
var4.addVertexWithUV(0.0D, (double) var9, (double) this.zLevel, (double) (0.5F - var6), (double) (0.5F + var7)); int var9 = this.height;
var4.addVertexWithUV((double) var8, (double) var9, (double) this.zLevel, (double) (0.5F - var6), (double) (0.5F - var7)); var4.addVertexWithUV(0.0D, (double) var9, (double) this.zLevel, (double) (0.5F - var6), (double) (0.5F + var7));
var4.addVertexWithUV((double) var8, 0.0D, (double) this.zLevel, (double) (0.5F + var6), (double) (0.5F - var7)); var4.addVertexWithUV((double) var8, (double) var9, (double) this.zLevel, (double) (0.5F - var6), (double) (0.5F - var7));
var4.addVertexWithUV(0.0D, 0.0D, (double) this.zLevel, (double) (0.5F + var6), (double) (0.5F + var7)); var4.addVertexWithUV((double) var8, 0.0D, (double) this.zLevel, (double) (0.5F + var6), (double) (0.5F - var7));
var4.draw(); var4.addVertexWithUV(0.0D, 0.0D, (double) this.zLevel, (double) (0.5F + var6), (double) (0.5F + var7));
var4.draw();
} else {
EaglerAdapter.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
this.drawPanorama(par1, par2, par3);
}
} }
private static final TextureLocation mclogo = new TextureLocation("/title/mclogo.png"); private static final TextureLocation mclogo = new TextureLocation("/title/mclogo.png");
@ -469,8 +485,10 @@ public class GuiMainMenu extends GuiScreen {
short var5 = 274; short var5 = 274;
int var6 = this.width / 2 - var5 / 2; int var6 = this.width / 2 - var5 / 2;
byte var7 = 30; byte var7 = 30;
this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215); if (ConfigConstants.panoramaBlur) {
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE); this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215);
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
}
if(ConfigConstants.eaglercraftTitleLogo) { if(ConfigConstants.eaglercraftTitleLogo) {
eag.bindTexture(); eag.bindTexture();

View file

@ -1549,15 +1549,13 @@ public class RenderGlobal implements IWorldAccess {
* Plays the specified record. Arg: recordName, x, y, z * Plays the specified record. Arg: recordName, x, y, z
*/ */
public void playRecord(String par1Str, int par2, int par3, int par4) { public void playRecord(String par1Str, int par2, int par3, int par4) {
Minecraft.getMinecraft().displayEaglercraftText("records have been deleted to reduce file size");
ItemRecord var5 = ItemRecord.getRecord(par1Str); ItemRecord var5 = ItemRecord.getRecord(par1Str);
if (par1Str != null && var5 != null) { if (par1Str != null && var5 != null) {
this.mc.ingameGUI.setRecordPlayingMessage(var5.getRecordTitle()); this.mc.ingameGUI.setRecordPlayingMessage(var5.getRecordTitle());
} }
this.mc.sndManager.playStreaming(par1Str, (float) par2, (float) par3, (float) par4); this.mc.sndManager.playStreaming(par1Str, (float)par2 + 0.5F, (float)par3 + 0.5F, (float)par4 + 0.5F, true);
} }
/** /**

View file

@ -2,21 +2,20 @@ package net.minecraft.src;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Set;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import net.lax1dude.eaglercraft.ServerQuery.QueryResponse;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.RateLimit;
import net.lax1dude.eaglercraft.Base64; import net.lax1dude.eaglercraft.Base64;
import net.lax1dude.eaglercraft.ConfigConstants; import net.lax1dude.eaglercraft.ConfigConstants;
import net.lax1dude.eaglercraft.EaglerAdapter; import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.LocalStorageManager; import net.lax1dude.eaglercraft.LocalStorageManager;
import net.lax1dude.eaglercraft.RelayEntry; import net.lax1dude.eaglercraft.RelayEntry;
import net.lax1dude.eaglercraft.ServerQuery.QueryResponse; import net.lax1dude.eaglercraft.EaglercraftRandom;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.RateLimit;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
public class ServerList { public class ServerList {
@ -28,7 +27,7 @@ public class ServerList {
private final List<ServerData> allServers = new ArrayList(); private final List<ServerData> allServers = new ArrayList();
public static final List<ServerData> forcedServers = new ArrayList(); public static final List<ServerData> forcedServers = new ArrayList();
private static final Set<String> motdLocks = new HashSet(); private static final EaglercraftRandom random = new EaglercraftRandom();
public static boolean hideDownDefaultServers = false; public static boolean hideDownDefaultServers = false;
@ -69,11 +68,13 @@ public class ServerList {
} }
// NOTE: Change these asap if one goes down or is replaced, they are used by replits // NOTE: Change these asap if one goes down or is replaced, they are used by replits
int choice = random.nextInt(3);
ConfigConstants.relays = new ArrayList(); ConfigConstants.relays = new ArrayList();
ConfigConstants.relays.add(new RelayEntry("wss://relay.deev.is/", "lax1dude relay #1", true)); ConfigConstants.relays.add(new RelayEntry("wss://relay.deev.is/", "lax1dude relay #1", choice == 0));
ConfigConstants.relays.add(new RelayEntry("wss://relay.lax1dude.net/", "lax1dude relay #2", false)); ConfigConstants.relays.add(new RelayEntry("wss://relay.lax1dude.net/", "lax1dude relay #2", choice == 1));
ConfigConstants.relays.add(new RelayEntry("wss://relay.shhnowisnottheti.me/", "ayunami relay #1", false)); ConfigConstants.relays.add(new RelayEntry("wss://relay.shhnowisnottheti.me/", "ayunami relay #1", choice == 2));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();

View file

@ -43,12 +43,14 @@ public class SoundManager {
private GameSettings options; private GameSettings options;
private ArrayList<EntitySoundEvent> soundevents; private ArrayList<EntitySoundEvent> soundevents;
private ArrayList<QueuedSoundEvent> queuedsoundevents; private ArrayList<QueuedSoundEvent> queuedsoundevents;
private ArrayList<Integer> activerecords;
private HashMap<String,Integer> sounddefinitions; private HashMap<String,Integer> sounddefinitions;
private EaglercraftRandom soundrandom; private EaglercraftRandom soundrandom;
public SoundManager() { public SoundManager() {
this.soundevents = new ArrayList(); this.soundevents = new ArrayList();
this.queuedsoundevents = new ArrayList(); this.queuedsoundevents = new ArrayList();
this.activerecords = new ArrayList();
this.sounddefinitions = null; this.sounddefinitions = null;
this.soundrandom = new EaglercraftRandom(); this.soundrandom = new EaglercraftRandom();
} }
@ -58,6 +60,7 @@ public class SoundManager {
*/ */
public void loadSoundSettings(GameSettings par1GameSettings) { public void loadSoundSettings(GameSettings par1GameSettings) {
this.options = par1GameSettings; this.options = par1GameSettings;
EaglerAdapter.setMusicVolume(options.musicVolume);
EaglerAdapter.setMasterVolume(options.soundVolume); EaglerAdapter.setMasterVolume(options.soundVolume);
if(this.sounddefinitions == null) { if(this.sounddefinitions == null) {
this.sounddefinitions = new HashMap(); this.sounddefinitions = new HashMap();
@ -85,6 +88,8 @@ public class SoundManager {
* Called when one of the sound level options has changed. * Called when one of the sound level options has changed.
*/ */
public void onSoundOptionsChanged() { public void onSoundOptionsChanged() {
EaglerAdapter.setMusicVolume(options.musicVolume);
EaglerAdapter.fireTitleMusicEvent(titleMusic != -1, options.musicVolume);
EaglerAdapter.setMasterVolume(options.soundVolume); EaglerAdapter.setMasterVolume(options.soundVolume);
} }
@ -130,10 +135,29 @@ public class SoundManager {
for(EntitySoundEvent e : soundevents) { for(EntitySoundEvent e : soundevents) {
EaglerAdapter.endSound(e.id); EaglerAdapter.endSound(e.id);
} }
for(Integer i : activerecords) {
EaglerAdapter.endSound(i.intValue());
}
} }
public void playStreaming(String par1Str, float par2, float par3, float par4) { public void playStreaming(String par1Str, float par2, float par3, float par4) {
playStreaming(par1Str, par2, par3, par4, false);
}
public void playStreaming(String par1Str, float par2, float par3, float par4, boolean music) {
for (Integer record : activerecords) {
EaglerAdapter.endSound(record.intValue());
}
activerecords.clear();
if (par1Str != null) {
String path = "/records/" + par1Str.replace('.', '/') + ".mp3";
int snd = EaglerAdapter.beginPlayback(path, par2, par3, par4, 1.0F, 1.0F, music);
if (snd != -1) {
activerecords.add(new Integer(snd));
} else {
System.err.println("unregistered record: "+par1Str);
}
}
} }
/** /**
@ -431,13 +455,15 @@ public class SoundManager {
public void playTheTitleMusic() { public void playTheTitleMusic() {
if(titleMusic == -1 || !EaglerAdapter.isPlaying(titleMusic)) { if(titleMusic == -1 || !EaglerAdapter.isPlaying(titleMusic)) {
titleMusic = EaglerAdapter.beginPlaybackStatic("/sounds/gta.mp3", 1.0f, 1.0f); titleMusic = EaglerAdapter.beginPlaybackStatic("/sounds/gta.mp3", 1.0f, 1.0f, true);
EaglerAdapter.fireTitleMusicEvent(true, this.options.musicVolume);
} }
} }
public void stopTheTitleMusic() { public void stopTheTitleMusic() {
if(EaglerAdapter.isPlaying(titleMusic)) { if(EaglerAdapter.isPlaying(titleMusic)) {
EaglerAdapter.endSound(titleMusic); EaglerAdapter.endSound(titleMusic);
EaglerAdapter.fireTitleMusicEvent(false, this.options.musicVolume);
} }
titleMusic = -1; titleMusic = -1;
} }

View file

@ -72,6 +72,7 @@ public class Client {
registerErrorHandler(); registerErrorHandler();
ServerList.loadDefaultServers(conf); ServerList.loadDefaultServers(conf);
AssetRepository.loadOverrides(conf);
LocalStorageManager.loadStorage(); LocalStorageManager.loadStorage();
run0(); run0();

View file

@ -47,6 +47,7 @@ import org.teavm.jso.dom.events.KeyboardEvent;
import org.teavm.jso.dom.events.MessageEvent; import org.teavm.jso.dom.events.MessageEvent;
import org.teavm.jso.dom.events.MouseEvent; import org.teavm.jso.dom.events.MouseEvent;
import org.teavm.jso.dom.events.WheelEvent; import org.teavm.jso.dom.events.WheelEvent;
import org.teavm.jso.dom.html.HTMLAudioElement;
import org.teavm.jso.dom.html.HTMLCanvasElement; import org.teavm.jso.dom.html.HTMLCanvasElement;
import org.teavm.jso.dom.html.HTMLDocument; import org.teavm.jso.dom.html.HTMLDocument;
import org.teavm.jso.dom.html.HTMLElement; import org.teavm.jso.dom.html.HTMLElement;
@ -64,6 +65,8 @@ import org.teavm.jso.webaudio.AudioBuffer;
import org.teavm.jso.webaudio.AudioBufferSourceNode; import org.teavm.jso.webaudio.AudioBufferSourceNode;
import org.teavm.jso.webaudio.AudioContext; import org.teavm.jso.webaudio.AudioContext;
import org.teavm.jso.webaudio.AudioListener; import org.teavm.jso.webaudio.AudioListener;
import org.teavm.jso.webaudio.AudioNode;
import org.teavm.jso.webaudio.ChannelMergerNode;
import org.teavm.jso.webaudio.DecodeErrorCallback; import org.teavm.jso.webaudio.DecodeErrorCallback;
import org.teavm.jso.webaudio.DecodeSuccessCallback; import org.teavm.jso.webaudio.DecodeSuccessCallback;
import org.teavm.jso.webaudio.GainNode; import org.teavm.jso.webaudio.GainNode;
@ -99,7 +102,6 @@ import net.lax1dude.eaglercraft.RelayServerSocket;
import net.lax1dude.eaglercraft.RelayWorldsQuery; import net.lax1dude.eaglercraft.RelayWorldsQuery;
import net.lax1dude.eaglercraft.ServerQuery; import net.lax1dude.eaglercraft.ServerQuery;
import net.lax1dude.eaglercraft.Voice; import net.lax1dude.eaglercraft.Voice;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.RateLimit;
import net.lax1dude.eaglercraft.adapter.teavm.EaglercraftLANClient; import net.lax1dude.eaglercraft.adapter.teavm.EaglercraftLANClient;
import net.lax1dude.eaglercraft.adapter.teavm.EaglercraftLANServer; import net.lax1dude.eaglercraft.adapter.teavm.EaglercraftLANServer;
import net.lax1dude.eaglercraft.adapter.teavm.EaglercraftVoiceClient; import net.lax1dude.eaglercraft.adapter.teavm.EaglercraftVoiceClient;
@ -161,10 +163,10 @@ public class EaglerAdapterImpl2 {
return contents.replace("\r\n", "\n").split("[\r\n]"); return contents.replace("\r\n", "\n").split("[\r\n]");
} }
} }
@Async @Async
public static native String downloadAssetPack(String assetPackageURI); public static native String downloadAssetPack(String assetPackageURI);
private static void downloadAssetPack(String assetPackageURI, final AsyncCallback<String> cb) { private static void downloadAssetPack(String assetPackageURI, final AsyncCallback<String> cb) {
final XMLHttpRequest request = XMLHttpRequest.create(); final XMLHttpRequest request = XMLHttpRequest.create();
request.setResponseType("arraybuffer"); request.setResponseType("arraybuffer");
@ -185,6 +187,33 @@ public class EaglerAdapterImpl2 {
request.send(); request.send();
} }
@Async
public static native byte[] downloadURL(String url);
private static void downloadURL(String url, final AsyncCallback<byte[]> cb) {
if(url.isEmpty()) {
cb.complete(new byte[0]);
return;
}
final XMLHttpRequest request = XMLHttpRequest.create();
request.setResponseType("arraybuffer");
request.open("GET", url, true);
request.setOnReadyStateChange(new ReadyStateChangeHandler() {
@Override
public void stateChanged() {
if(request.getReadyState() == XMLHttpRequest.DONE) {
Uint8Array bl = Uint8Array.create((ArrayBuffer)request.getResponse());
byte[] res = new byte[bl.getByteLength()];
for(int i = 0; i < res.length; ++i) {
res[i] = (byte) bl.get(i);
}
cb.complete(res);
}
}
});
request.send();
}
@JSBody(params = { "v", "s" }, script = "window[v] = s;") @JSBody(params = { "v", "s" }, script = "window[v] = s;")
public static native void setDebugVar(String v, String s); public static native void setDebugVar(String v, String s);
@ -396,6 +425,9 @@ public class EaglerAdapterImpl2 {
masterVolumeNode = audioctx.createGain(); masterVolumeNode = audioctx.createGain();
masterVolumeNode.getGain().setValue(1.0f); masterVolumeNode.getGain().setValue(1.0f);
masterVolumeNode.connect(audioctx.getDestination()); masterVolumeNode.connect(audioctx.getDestination());
musicVolumeNode = audioctx.createGain();
musicVolumeNode.getGain().setValue(1.0f);
musicVolumeNode.connect(audioctx.getDestination());
mouseEvents.clear(); mouseEvents.clear();
keyEvents.clear(); keyEvents.clear();
@ -1954,18 +1986,47 @@ public class EaglerAdapterImpl2 {
} }
private static int playbackId = 0; private static int playbackId = 0;
private static int audioElementId = 0;
private static final HashMap<String,AudioBufferX> loadedSoundFiles = new HashMap(); private static final HashMap<String,AudioBufferX> loadedSoundFiles = new HashMap();
private static AudioContext audioctx = null; private static AudioContext audioctx = null;
private static GainNode masterVolumeNode = null; private static GainNode masterVolumeNode = null;
private static GainNode musicVolumeNode = null;
private static float playbackOffsetDelay = 0.03f; private static float playbackOffsetDelay = 0.03f;
public static final void setPlaybackOffsetDelay(float f) { public static final void setPlaybackOffsetDelay(float f) {
playbackOffsetDelay = f; playbackOffsetDelay = f;
} }
private static final void setGainlessAudioVolume(float oldGain, float f, boolean music) {
if (f != oldGain) {
for (AudioSourceNodeX a : activeSoundEffects.values()) {
if (a.music == music && a instanceof MediaElementAudioSourceNodeX && a.gain == null) {
HTMLAudioElement aud = ((MediaElementAudioSourceNodeX) a).audio;
float newVolume = 0.5F;
if (oldGain == 0) {
aud.setMuted(false);
newVolume = f * aud.getVolume();
} else if (f == 0) {
aud.setMuted(true);
newVolume = aud.getVolume() / oldGain;
} else {
newVolume = f * aud.getVolume() / oldGain;
}
aud.setVolume(newVolume > 1.0f ? 1.0f : newVolume);
}
}
}
}
public static final void setMasterVolume(float f) { public static final void setMasterVolume(float f) {
setGainlessAudioVolume(masterVolumeNode.getGain().getValue(), f, false);
masterVolumeNode.getGain().setValue(f); masterVolumeNode.getGain().setValue(f);
} }
public static final void setMusicVolume(float f) {
setGainlessAudioVolume(musicVolumeNode.getGain().getValue(), f, true);
musicVolumeNode.getGain().setValue(f);
}
@Async @Async
public static native AudioBuffer decodeAudioAsync(ArrayBuffer buffer); public static native AudioBuffer decodeAudioAsync(ArrayBuffer buffer);
@ -1984,8 +2045,8 @@ public class EaglerAdapterImpl2 {
}); });
} }
private static final HashMap<Integer,AudioBufferSourceNodeX> activeSoundEffects = new HashMap(); private static final HashMap<Integer,AudioSourceNodeX> activeSoundEffects = new HashMap();
private static class AudioBufferX { private static class AudioBufferX {
private final AudioBuffer buffer; private final AudioBuffer buffer;
private AudioBufferX(AudioBuffer buffer) { private AudioBufferX(AudioBuffer buffer) {
@ -1993,16 +2054,37 @@ public class EaglerAdapterImpl2 {
} }
} }
private static class AudioBufferSourceNodeX { private static class AudioSourceNodeX {
private final AudioBufferSourceNode source;
private final PannerNode panner; private final PannerNode panner;
private final GainNode gain; private final GainNode gain;
private AudioBufferSourceNodeX(AudioBufferSourceNode source, PannerNode panner, GainNode gain) { private final boolean music;
this.source = source; private AudioSourceNodeX(PannerNode panner, GainNode gain, boolean music) {
this.panner = panner; this.panner = panner;
this.gain = gain; this.gain = gain;
this.music = music;
} }
} }
private static class AudioBufferSourceNodeX extends AudioSourceNodeX {
private final AudioBufferSourceNode source;
private AudioBufferSourceNodeX(AudioBufferSourceNode source, PannerNode panner, GainNode gain, boolean music) {
super(panner, gain, music);
this.source = source;
}
}
private static class MediaElementAudioSourceNodeX extends AudioSourceNodeX {
private final MediaElementAudioSourceNode source;
private final HTMLAudioElement audio;
private MediaElementAudioSourceNodeX(MediaElementAudioSourceNode source, HTMLAudioElement audio, PannerNode panner, GainNode gain, boolean music) {
super(panner, gain, music);
this.source = source;
this.audio = audio;
}
}
@JSBody(params = { "playing", "volume" }, script = "window.dispatchEvent(new CustomEvent('eagTitleMusic', { detail: { playing: playing, volume: volume } }));return;")
public static native void fireTitleMusicEvent(boolean playing, float volume);
private static final AudioBuffer getBufferFor(String fileName) { private static final AudioBuffer getBufferFor(String fileName) {
AudioBufferX ret = loadedSoundFiles.get(fileName); AudioBufferX ret = loadedSoundFiles.get(fileName);
@ -2017,11 +2099,30 @@ public class EaglerAdapterImpl2 {
return ret.buffer; return ret.buffer;
} }
public static final int beginPlayback(String fileName, float x, float y, float z, float volume, float pitch) { public static final int beginPlayback(String fileName, float x, float y, float z, float volume, float pitch) {
AudioBuffer b = getBufferFor(fileName); return beginPlayback(fileName, x, y, z, volume, pitch, false);
if(b == null) return -1; }
AudioBufferSourceNode s = audioctx.createBufferSource(); public static final int beginPlayback(String fileNamePre, float x, float y, float z, float volume, float pitch, boolean music) {
s.setBuffer(b); if(fileNamePre.startsWith("/")) fileNamePre = fileNamePre.substring(1);
s.getPlaybackRate().setValue(pitch); String fileName = AssetRepository.fileNameOverrides.getOrDefault(fileNamePre, fileNamePre);
AudioNode s;
HTMLAudioElement audioElement = null;
String lowerFileName = fileName.toLowerCase();
boolean usingUrl = AssetRepository.fileNameOverrides.containsKey(fileNamePre) || lowerFileName.startsWith("http://") || lowerFileName.startsWith("https://") || lowerFileName.startsWith("blob:") || lowerFileName.startsWith("data:");
if (usingUrl) {
audioElement = (HTMLAudioElement) win.getDocument().createElement("audio");
audioElement.setAutoplay(true);
audioElement.setCrossOrigin("anonymous");
audioElement.setSrc(fileName);
s = audioctx.createMediaElementSource(audioElement);
audioElement.setPlaybackRate(pitch);
} else {
AudioBuffer b = getBufferFor(fileName);
if(b == null) return -1;
s = audioctx.createBufferSource();
((AudioBufferSourceNode) s).setBuffer(b);
((AudioBufferSourceNode) s).getPlaybackRate().setValue(pitch);
}
ChannelMergerNode c = audioctx.createChannelMerger(1);
PannerNode p = audioctx.createPanner(); PannerNode p = audioctx.createPanner();
p.setPosition(x, y, z); p.setPosition(x, y, z);
p.setMaxDistance(volume * 16f + 0.1f); p.setMaxDistance(volume * 16f + 0.1f);
@ -2035,69 +2136,146 @@ public class EaglerAdapterImpl2 {
p.setOrientation(0f, 1f, 0f); p.setOrientation(0f, 1f, 0f);
GainNode g = audioctx.createGain(); GainNode g = audioctx.createGain();
g.getGain().setValue(volume > 1.0f ? 1.0f : volume); g.getGain().setValue(volume > 1.0f ? 1.0f : volume);
s.connect(g); s.connect(c);
c.connect(g);
g.connect(p); g.connect(p);
p.connect(masterVolumeNode); p.connect(music ? musicVolumeNode : masterVolumeNode);
s.start(0.0d, playbackOffsetDelay); if (!usingUrl) {
((AudioBufferSourceNode) s).start(0.0d, playbackOffsetDelay);
}
final int theId = ++playbackId; final int theId = ++playbackId;
activeSoundEffects.put(theId, new AudioBufferSourceNodeX(s, p, g)); if (usingUrl) {
s.setOnEnded(new EventListener<MediaEvent>() { activeSoundEffects.put(theId, new MediaElementAudioSourceNodeX((MediaElementAudioSourceNode) s, audioElement, p, g, music));
audioElement.addEventListener("canplay", new EventListener<Event>() {
@Override @Override
public void handleEvent(MediaEvent evt) { public void handleEvent(Event evt) {
activeSoundEffects.remove(theId); if (activeSoundEffects.containsKey(theId)) {
} ((MediaElementAudioSourceNodeX) activeSoundEffects.get(theId)).audio.play();
}
}); }
});
audioElement.addEventListener("ended", new EventListener<Event>() {
@Override
public void handleEvent(Event evt) {
((MediaElementAudioSourceNodeX) activeSoundEffects.remove(theId)).audio.setSrc("");
}
});
} else {
activeSoundEffects.put(theId, new AudioBufferSourceNodeX((AudioBufferSourceNode) s, p, g, music));
((AudioBufferSourceNode) s).setOnEnded(new EventListener<MediaEvent>() {
@Override
public void handleEvent(MediaEvent evt) {
activeSoundEffects.remove(theId);
}
});
}
return theId; return theId;
} }
public static final int beginPlaybackStatic(String fileName, float volume, float pitch) { public static final int beginPlaybackStatic(String fileName, float volume, float pitch) {
AudioBuffer b = getBufferFor(fileName); return beginPlaybackStatic(fileName, volume, pitch, false);
if(b == null) return -1; }
AudioBufferSourceNode s = audioctx.createBufferSource(); public static final int beginPlaybackStatic(String fileNamePre, float volume, float pitch, boolean music) {
s.setBuffer(b); if(fileNamePre.startsWith("/")) fileNamePre = fileNamePre.substring(1);
s.getPlaybackRate().setValue(pitch); String fileName = AssetRepository.fileNameOverrides.getOrDefault(fileNamePre, fileNamePre);
GainNode g = audioctx.createGain(); AudioNode s = null;
g.getGain().setValue(volume > 1.0f ? 1.0f : volume); GainNode g = null;
s.connect(g); HTMLAudioElement audioElement = null;
g.connect(masterVolumeNode); String lowerFileName = fileName.toLowerCase();
s.start(0.0d, playbackOffsetDelay); boolean usingUrl = AssetRepository.fileNameOverrides.containsKey(fileNamePre) || lowerFileName.startsWith("http://") || lowerFileName.startsWith("https://") || lowerFileName.startsWith("blob:") || lowerFileName.startsWith("data:");
final int theId = ++playbackId; if (usingUrl) {
activeSoundEffects.put(theId, new AudioBufferSourceNodeX(s, null, g)); audioElement = (HTMLAudioElement) win.getDocument().createElement("audio");
s.setOnEnded(new EventListener<MediaEvent>() { audioElement.setAutoplay(true);
// audioElement.setCrossOrigin("anonymous");
audioElement.setSrc(fileName);
audioElement.setPlaybackRate(pitch);
} else {
AudioBuffer b = getBufferFor(fileName);
if(b == null) return -1;
s = audioctx.createBufferSource();
((AudioBufferSourceNode) s).setBuffer(b);
((AudioBufferSourceNode) s).getPlaybackRate().setValue(pitch);
g = audioctx.createGain();
g.getGain().setValue(volume > 1.0f ? 1.0f : volume);
s.connect(g);
g.connect(music ? musicVolumeNode : masterVolumeNode);
((AudioBufferSourceNode) s).start(0.0d, playbackOffsetDelay);
}
@Override final int theId = ++playbackId;
public void handleEvent(MediaEvent evt) { if (usingUrl) {
activeSoundEffects.remove(theId); activeSoundEffects.put(theId, new MediaElementAudioSourceNodeX(null, audioElement, null, null, music));
} audioElement.addEventListener("canplay", new EventListener<Event>() {
@Override
}); public void handleEvent(Event evt) {
return playbackId; if (activeSoundEffects.containsKey(theId)) {
((MediaElementAudioSourceNodeX) activeSoundEffects.get(theId)).audio.play();
}
}
});
audioElement.addEventListener("ended", new EventListener<Event>() {
@Override
public void handleEvent(Event evt) {
((MediaElementAudioSourceNodeX) activeSoundEffects.remove(theId)).audio.setSrc("");
}
});
} else {
activeSoundEffects.put(theId, new AudioBufferSourceNodeX(((AudioBufferSourceNode) s), null, g, music));
((AudioBufferSourceNode) s).setOnEnded(new EventListener<MediaEvent>() {
@Override
public void handleEvent(MediaEvent evt) {
activeSoundEffects.remove(theId);
}
});
}
return theId;
} }
public static final void setPitch(int id, float pitch) { public static final void setPitch(int id, float pitch) {
AudioBufferSourceNodeX b = activeSoundEffects.get(id); AudioSourceNodeX a = activeSoundEffects.get(id);
if(b != null) { if(a != null) {
b.source.getPlaybackRate().setValue(pitch); if (a instanceof AudioBufferSourceNodeX) {
((AudioBufferSourceNodeX) a).source.getPlaybackRate().setValue(pitch);
} else if (a instanceof MediaElementAudioSourceNodeX) {
((MediaElementAudioSourceNodeX) a).audio.setPlaybackRate(pitch);
}
} }
} }
public static final void setVolume(int id, float volume) { public static final void setVolume(int id, float volume) {
AudioBufferSourceNodeX b = activeSoundEffects.get(id); AudioSourceNodeX a = activeSoundEffects.get(id);
if(b != null) { if(a != null) {
b.gain.getGain().setValue(volume > 1.0f ? 1.0f : volume); if (a instanceof MediaElementAudioSourceNodeX && a.gain == null) {
if(b.panner != null) b.panner.setMaxDistance(volume * 16f + 0.1f); HTMLAudioElement audioElem = ((MediaElementAudioSourceNodeX) a).audio;
float gainValue = (a.music ? musicVolumeNode : masterVolumeNode).getGain().getValue();
float newVolume;
if (gainValue == 0) {
audioElem.setMuted(true);
newVolume = volume;
} else {
audioElem.setMuted(false);
newVolume = gainValue * volume;
}
audioElem.setVolume(newVolume > 1.0f ? 1.0f : volume);
} else {
a.gain.getGain().setValue(volume > 1.0f ? 1.0f : volume);
if (a.panner != null) a.panner.setMaxDistance(volume * 16f + 0.1f);
}
} }
} }
public static final void moveSound(int id, float x, float y, float z, float vx, float vy, float vz) { public static final void moveSound(int id, float x, float y, float z, float vx, float vy, float vz) {
AudioBufferSourceNodeX b = activeSoundEffects.get(id); AudioSourceNodeX a = activeSoundEffects.get(id);
if(b != null && b.panner != null) { if(a != null && a.panner != null) {
b.panner.setPosition(x, y, z); a.panner.setPosition(x, y, z);
//b.panner.setVelocity(vx, vy, vz); //a.panner.setVelocity(vx, vy, vz);
} }
} }
public static final void endSound(int id) { public static final void endSound(int id) {
AudioBufferSourceNodeX b = activeSoundEffects.get(id); AudioSourceNodeX a = activeSoundEffects.get(id);
if(b != null) { if(a != null) {
b.source.stop(); if (a instanceof AudioBufferSourceNodeX) {
((AudioBufferSourceNodeX) a).source.stop();
} else if (a instanceof MediaElementAudioSourceNodeX) {
((MediaElementAudioSourceNodeX) a).audio.pause();
((MediaElementAudioSourceNodeX) a).audio.setSrc("");
}
activeSoundEffects.remove(id); activeSoundEffects.remove(id);
} }
} }
@ -3771,6 +3949,7 @@ public class EaglerAdapterImpl2 {
rtcLANClient.setRemoteDataChannelHandler(new EaglercraftLANClient.ClientSignalHandler() { rtcLANClient.setRemoteDataChannelHandler(new EaglercraftLANClient.ClientSignalHandler() {
@Override @Override
public void call() { public void call() {
clientDataChannelClosed = false;
clientDataChannelOpen = true; clientDataChannelOpen = true;
} }
}); });
@ -3804,7 +3983,7 @@ public class EaglerAdapterImpl2 {
clientICECandidate = null; clientICECandidate = null;
clientDescription = null; clientDescription = null;
clientDataChannelOpen = false; clientDataChannelOpen = false;
clientDataChannelClosed = false; clientDataChannelClosed = true;
} }
public static final String clientLANAwaitICECandidate() { public static final String clientLANAwaitICECandidate() {
@ -3924,7 +4103,7 @@ public class EaglerAdapterImpl2 {
} }
} }
private static final int fragmentSize = 16384; private static final int fragmentSize = 65536;
public static final void serverLANWritePacket(String peer, byte[] data) { public static final void serverLANWritePacket(String peer, byte[] data) {
if (data.length > fragmentSize) { if (data.length > fragmentSize) {

File diff suppressed because one or more lines are too long

View file

@ -60,7 +60,7 @@ servers:
address: localhost:25569 address: localhost:25569
restricted: false restricted: false
origin_blacklist_block_offline_download: false origin_blacklist_block_offline_download: false
origin_blacklist_block_missing_origin_header: false origin_blacklist_block_missing_origin_header: true
permissions: permissions:
default: default:
- bungeecord.command.server - bungeecord.command.server
@ -84,7 +84,7 @@ permissions:
- bungeecord.command.eag.blockdomainname - bungeecord.command.eag.blockdomainname
- bungeecord.command.eag.unblockdomain - bungeecord.command.eag.unblockdomain
origin_blacklist_subscriptions: origin_blacklist_subscriptions:
- https://g.eags.us/eaglercraft/origin_blacklist.txt - https://g.lax1dude.net/eaglercraft/origin_blacklist.txt
- https://raw.githubusercontent.com/LAX1DUDE/eaglercraft/main/stable-download/origin_blacklist.txt - https://raw.githubusercontent.com/LAX1DUDE/eaglercraft/main/stable-download/origin_blacklist.txt
display_ban_type_on_kick: false display_ban_type_on_kick: false
timeout: 30000 timeout: 30000

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -20,15 +20,16 @@ if(document.location.href.startsWith("file:")) {
alert("You cannot 'open' this file in your browser, the code doesn't work. Upload this folder to your HTTP(s) server and access it via the internet to launch the stable-download game. This is not a bug, please read the documentation"); alert("You cannot 'open' this file in your browser, the code doesn't work. Upload this folder to your HTTP(s) server and access it via the internet to launch the stable-download game. This is not a bug, please read the documentation");
}else { }else {
window.addEventListener("load", function(){ window.addEventListener("load", function(){
const relayId = Math.floor(Math.random() * 3);
window.eaglercraftOpts = { window.eaglercraftOpts = {
container: "game_frame", assetsURI: "assets.epk", serverWorkerURI: "worker_bootstrap.js", worldsFolder: "MAIN", container: "game_frame", assetsURI: "assets.epk", serverWorkerURI: "worker_bootstrap.js", worldsFolder: "MAIN",
servers: [ servers: [
{ serverName: "placeholder", serverAddress: "address here", hideAddress: false } { serverName: "placeholder", serverAddress: "address here", hideAddress: false }
], ],
relays: [ relays: [
{ addr: "wss://relay.deev.is/", name: "lax1dude relay #1", primary: true }, { addr: "wss://relay.deev.is/", name: "lax1dude relay #1", primary: relayId == 0 },
{ addr: "wss://relay.lax1dude.net/", name: "lax1dude relay #2" }, { addr: "wss://relay.lax1dude.net/", name: "lax1dude relay #2", primary: relayId == 1 },
{ addr: "wss://relay.shhnowisnottheti.me/", name: "ayunami relay #1" } { addr: "wss://relay.shhnowisnottheti.me/", name: "ayunami relay #1", primary: relayId == 2 }
], ],
mainMenu: { splashes: [ mainMenu: { splashes: [
"Darviglet!", "eaglerenophile!", "You Eagler!", "Yeeeeeee!", "yeee", "Darviglet!", "eaglerenophile!", "You Eagler!", "Yeeeeeee!", "yeee",

View file

@ -106,6 +106,7 @@ window.addEventListener("load", function() {
countdown(); countdown();
setTimeout(function(){ setTimeout(function(){
document.getElementById("locally").remove(); document.getElementById("locally").remove();
const relayId = Math.floor(Math.random() * 3);
window.eaglercraftOpts = { window.eaglercraftOpts = {
container: "game_frame", assetsURI: getAssetsURI(), container: "game_frame", assetsURI: getAssetsURI(),
serverWorkerURI: createWorkerURI("sp_worker"), serverWorkerURI: createWorkerURI("sp_worker"),
@ -114,9 +115,9 @@ window.addEventListener("load", function() {
"EEEEEEEEE!", "You Darvig!", "You Vigg!", ":>", "|>", "You Yumpster!" "EEEEEEEEE!", "You Darvig!", "You Vigg!", ":>", "|>", "You Yumpster!"
]}, worldsFolder: "OFFLINE", serverListTitle: "Ayonull hosts a list of servers:", ]}, worldsFolder: "OFFLINE", serverListTitle: "Ayonull hosts a list of servers:",
serverListLink: "https://eagler.nully.tech/servers", relays: [ serverListLink: "https://eagler.nully.tech/servers", relays: [
{ addr: "wss://relay.deev.is/", name: "lax1dude relay #1", primary: true }, { addr: "wss://relay.deev.is/", name: "lax1dude relay #1", primary: relayId == 0 },
{ addr: "wss://relay.lax1dude.net/", name: "lax1dude relay #2" }, { addr: "wss://relay.lax1dude.net/", name: "lax1dude relay #2", primary: relayId == 1 },
{ addr: "wss://relay.shhnowisnottheti.me/", name: "ayunami relay #1" } ] { addr: "wss://relay.shhnowisnottheti.me/", name: "ayunami relay #1", primary: relayId == 2 } ]
}; };
main(); main();
}, 6000); }, 6000);

59
zip-generator/livestream_index.html vendored Normal file
View file

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html>
<head>
<title>eagler</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Eaglercraft is real Minecraft 1.5.2 that you can play in any regular web browser. That includes school chromebooks, it works on all chromebooks. It supports both singleplayer and multiplayer with no extensions." />
<meta name="keywords" content="minecraft, eaglercraft, singleplayer, applet, replit, browser, html5, javascript, chromebook, lax1dude, games, eagler" />
<meta name="author" content="lax1dude" />
<meta property="og:title" content="Eaglercraft" />
<meta property="og:locale" content="en-US" />
<meta property="og:type" content="website" />
<!-- Change this: <meta property="og:image" content="https://media.discordapp.net/attachments/378764518081429506/932053915061587978/thumbnail2.png" /> -->
<meta property="og:description" content="Eaglercraft is real Minecraft 1.5.2 that you can play in any regular web browser. That includes school chromebooks, it works on all chromebooks. It supports both singleplayer and multiplayer with no extensions." />
<!-- Change this: <meta property="og:url" content="https://g.eags.us/eaglercraft/" /> -->
<script type="text/javascript" src="classes.js"></script>
<script type="text/javascript" src="eagswebrtc.js"></script>
<script type="text/javascript">
if(document.location.href.startsWith("file:")) {
alert("You cannot 'open' this file in your browser, the code doesn't work. Upload this folder to your HTTP(s) server and access it via the internet to launch the stable-download game. This is not a bug, please read the documentation");
}else {
window.addEventListener("load", function(){
const relayId = Math.floor(Math.random() * 3);
window.eaglercraftOpts = {
container: "game_frame", assetsURI: "assets.epk", serverWorkerURI: "worker_bootstrap.js", worldsFolder: "MAIN",
assetOverrides: {
"records/mellohi.mp3": "https://stream.nightride.fm/chillsynth.m4a",
"records/far.mp3": "https://stream.nightride.fm/nightride.m4a",
"records/cat.mp3": "https://usa9.fastcast4u.com/proxy/jamz?mp=/1",
"records/blocks.mp3": "https://www.ophanim.net:8444/s/9780",
"records/13.mp3": "https://s2.radio.co/s2b2b68744/listen"
},
servers: [
{ serverName: "placeholder", serverAddress: "address here", hideAddress: false }
],
relays: [
{ addr: "wss://relay.deev.is/", name: "lax1dude relay #1", primary: relayId == 0 },
{ addr: "wss://relay.lax1dude.net/", name: "lax1dude relay #2", primary: relayId == 1 },
{ addr: "wss://relay.shhnowisnottheti.me/", name: "ayunami relay #1", primary: relayId == 2 }
],
mainMenu: { splashes: [
"Darviglet!", "eaglerenophile!", "You Eagler!", "Yeeeeeee!", "yeee",
"EEEEEEEEE!", "You Darvig!", "You Vigg!", ":>", "|>", "You Yumpster!"
], eaglerLogo: false }};
(function(){
var q = window.location.search;
if(typeof q === 'string' && q.startsWith("?")) {
q = new URLSearchParams(q);
var s = q.get("server");
if(s) window.minecraftOpts.push(s);
}
})();
main();
});}
</script>
</head>
<body style="margin:0px;width:100vw;height:100vh;" id="game_frame">
</body>
</html>

View file

@ -121,6 +121,19 @@ public class ZipGenerator {
IOUtils.write(FileUtils.readFileToByteArray(new File("zip-generator/repl_index.html")), zOut); IOUtils.write(FileUtils.readFileToByteArray(new File("zip-generator/repl_index.html")), zOut);
zOut.close(); zOut.close();
System.out.println("Writing 'stable-download/stable-download_livestream.zip'");
zOut = new ZipOutputStream(new FileOutputStream(new File("stable-download/stable-download_livestream.zip")));
zOut.setLevel(9);
zipFolder(zOut, "web", new File("stable-download/web"), "web/index.html");
zipFolder(zOut, "java", new File("stable-download/java"));
zOut.putNextEntry(new ZipEntry("web/index.html"));
IOUtils.write(FileUtils.readFileToByteArray(new File("zip-generator/livestream_index.html")), zOut);
zOut.close();
} }

Binary file not shown.