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
**Currently maintained by [ayunami2000](https://github.com/ayunami2000)**
### 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)

View File

@ -62,7 +62,7 @@ public class ServerConnector extends PacketHandler
@Override
public void exception(final Throwable t) throws Exception {
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);
}
else {
@ -94,7 +94,9 @@ public class ServerConnector extends PacketHandler
@Override
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");
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 ServerConnectedEvent event = new ServerConnectedEvent(this.user, server);
this.bungee.getPluginManager().callEvent(event);
@ -117,7 +119,7 @@ public class ServerConnector extends PacketHandler
this.ch.write(this.user.getSettings());
}
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.setServerEntityId(login.getEntityId());
Packet1Login modLogin;
@ -210,7 +212,7 @@ public class ServerConnector extends PacketHandler
return;
}
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);
}
else {
@ -220,8 +222,8 @@ public class ServerConnector extends PacketHandler
@Override
public void handle(final PacketFAPluginMessage pluginMessage) throws Exception {
if (pluginMessage.equals(PacketConstants.I_AM_BUNGEE)) {
throw new IllegalStateException("May not connect to another BungeCord!");
if (pluginMessage.equals(PacketConstants.I_AM_BUNGEE) && !BungeeCord.getInstance().config.allowBungeeOnBungee()) {
throw new IllegalStateException("May not connect to another BungeeCord!");
}
if (pluginMessage.getTag().equals("FML") && (pluginMessage.getData()[0] & 0xFF) == 0x0) {
final ByteArrayDataInput in = ByteStreams.newDataInput(pluginMessage.getData());

View File

@ -130,7 +130,7 @@ public final class UserConnection implements ProxiedPlayer {
return;
}
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!");
return;
}
@ -151,10 +151,10 @@ public final class UserConnection implements ProxiedPlayer {
future.channel().close();
UserConnection.this.pendingConnects.remove(target);
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.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());
} else {
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.unsafe().sendPacket(new PacketFFKick(reason));
this.ch.close();
if (this.server != null) {
if (this.server != null && this.server.getInfo() != null) {
this.server.disconnect("Quitting");
}
}

View File

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

View File

@ -21,7 +21,7 @@ public class CommandFind extends Command {
sender.sendMessage(ChatColor.RED + "Please follow this command by a user name");
} else {
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");
} else {
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) {
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.sendMessage(ChatColor.GOLD + "Summoned to " + target.getName() + " by " + sender.getName());
}

View File

@ -39,6 +39,7 @@ public class Configuration {
private boolean acceptBukkitConsoleCommandPacket;
private Collection<String> disabledCommands;
private Collection<String> iceServers;
private boolean bungeeOnBungee;
public Configuration() {
this.timeout = 30000;
@ -70,9 +71,10 @@ public class Configuration {
this.showBanType = adapter.getBoolean("display_ban_type_on_kick", false);
this.blacklistOfflineDownload = adapter.getBoolean("origin_blacklist_block_offline_download", 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.acceptBukkitConsoleCommandPacket = adapter.getBoolean("accept_bukkit_console_command_packets", false);
this.bungeeOnBungee = adapter.getBoolean("bungee_on_bungee", false);
this.disabledCommands = adapter.getDisabledCommands();
this.iceServers = adapter.getICEServers();
Preconditions.checkArgument(this.listeners != null && !this.listeners.isEmpty(), (Object) "No listeners defined.");
@ -171,4 +173,8 @@ public class Configuration {
return iceServers;
}
public boolean allowBungeeOnBungee() {
return bungeeOnBungee;
}
}

View File

@ -47,7 +47,7 @@ public class UpstreamBridge extends PacketHandler {
this.bungee.getPluginManager().callEvent(event);
this.con.getTabList().onDisconnect();
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");
}
}

View File

@ -1,8 +1,10 @@
package net.md_5.bungee.eaglercraft;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import net.md_5.bungee.BungeeCord;
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.config.ServerInfo;
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.netty.ChannelWrapper;
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.Packet0KeepAlive;
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 {
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
public void handle(final Packet3Chat chat) throws Exception {
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.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);
this.con.setServer(new ServerConnection(null, null));
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

30
javascript/index.html vendored
View File

@ -4,21 +4,43 @@
<title>eagler</title>
<meta charset="UTF-8" />
<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">
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");
}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 = {
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: [
{ serverName: "Local Test Server", serverAddress: "localhost:25565", hideAddress: false }
],
relays: [
{ addr: "wss://relay.deev.is/", name: "lax1dude relay #1", primary: true },
{ addr: "wss://relay.lax1dude.net/", name: "lax1dude relay #2" },
{ addr: "wss://relay.shhnowisnottheti.me/", name: "ayunami relay #1" }
{ 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",

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.GZIPInputStream;
import com.jcraft.jzlib.InflaterInputStream;
import org.json.JSONArray;
import org.json.JSONObject;
public class AssetRepository {
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 {
ByteArrayInputStream in = new ByteArrayInputStream(pkg);
@ -210,4 +229,8 @@ public class AssetRepository {
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 final String version = "22w34b";
public static final String version = "22w35a";
public static final String mainMenuString = "eaglercraft " + version;
public static final String forkMe = "https://github.com/lax1dude/eaglercraft";
@ -27,4 +27,6 @@ public class ConfigConstants {
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[] 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" };
public float musicVolume = 0.0F;
public float musicVolume = 1.0F;
public float soundVolume = 1.0F;
public float mouseSensitivity = 0.5F;
public boolean invertMouse = false;

View File

@ -5,6 +5,7 @@ import java.util.Calendar;
import java.util.Date;
import java.util.List;
import net.lax1dude.eaglercraft.AssetRepository;
import net.lax1dude.eaglercraft.ConfigConstants;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglercraftRandom;
@ -170,6 +171,8 @@ public class GuiMainMenu extends GuiScreen {
this.field_92019_w = this.field_92021_u + 12;
}
ConfigConstants.panoramaBlur = AssetRepository.getResource("/title/no-pano-blur.flag") == null;
if(this.ackLines.isEmpty()) {
int width = 315;
String file = EaglerAdapter.fileContents("/credits.txt");
@ -313,7 +316,11 @@ public class GuiMainMenu extends GuiScreen {
EaglerAdapter.glMatrixMode(EaglerAdapter.GL_PROJECTION);
EaglerAdapter.glPushMatrix();
EaglerAdapter.glLoadIdentity();
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.glPushMatrix();
EaglerAdapter.glLoadIdentity();
@ -362,7 +369,11 @@ public class GuiMainMenu extends GuiScreen {
titlePanoramaPaths[var10].bindTexture();
var4.startDrawingQuads();
if (ConfigConstants.panoramaBlur) {
var4.setColorRGBA_I(16777215, 255 / (var6 + 1));
} else {
var4.setColorRGBA_I(16777215, 255);
}
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) (1.0F - var11), (double) (0.0F + var11));
@ -422,6 +433,7 @@ public class GuiMainMenu extends GuiScreen {
* Renders the skybox in the main menu
*/
private void renderSkybox(int par1, int par2, float par3) {
if (ConfigConstants.panoramaBlur) {
EaglerAdapter.glViewport(0, 0, 256, 256);
this.drawPanorama(par1, par2, par3);
EaglerAdapter.glDisable(EaglerAdapter.GL_TEXTURE_2D);
@ -450,6 +462,10 @@ public class GuiMainMenu extends GuiScreen {
var4.addVertexWithUV((double) var8, 0.0D, (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.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");
@ -469,8 +485,10 @@ public class GuiMainMenu extends GuiScreen {
short var5 = 274;
int var6 = this.width / 2 - var5 / 2;
byte var7 = 30;
if (ConfigConstants.panoramaBlur) {
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) {
eag.bindTexture();

View File

@ -1549,15 +1549,13 @@ public class RenderGlobal implements IWorldAccess {
* Plays the specified record. Arg: recordName, x, y, z
*/
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);
if (par1Str != null && var5 != null) {
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.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.json.JSONArray;
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.ConfigConstants;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.LocalStorageManager;
import net.lax1dude.eaglercraft.RelayEntry;
import net.lax1dude.eaglercraft.ServerQuery.QueryResponse;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.RateLimit;
import net.lax1dude.eaglercraft.EaglercraftRandom;
import net.minecraft.client.Minecraft;
public class ServerList {
@ -28,7 +27,7 @@ public class ServerList {
private final List<ServerData> allServers = 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;
@ -70,10 +69,12 @@ public class ServerList {
// 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.add(new RelayEntry("wss://relay.deev.is/", "lax1dude relay #1", true));
ConfigConstants.relays.add(new RelayEntry("wss://relay.lax1dude.net/", "lax1dude relay #2", false));
ConfigConstants.relays.add(new RelayEntry("wss://relay.shhnowisnottheti.me/", "ayunami relay #1", false));
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", choice == 1));
ConfigConstants.relays.add(new RelayEntry("wss://relay.shhnowisnottheti.me/", "ayunami relay #1", choice == 2));
} catch (IOException e) {
e.printStackTrace();

View File

@ -43,12 +43,14 @@ public class SoundManager {
private GameSettings options;
private ArrayList<EntitySoundEvent> soundevents;
private ArrayList<QueuedSoundEvent> queuedsoundevents;
private ArrayList<Integer> activerecords;
private HashMap<String,Integer> sounddefinitions;
private EaglercraftRandom soundrandom;
public SoundManager() {
this.soundevents = new ArrayList();
this.queuedsoundevents = new ArrayList();
this.activerecords = new ArrayList();
this.sounddefinitions = null;
this.soundrandom = new EaglercraftRandom();
}
@ -58,6 +60,7 @@ public class SoundManager {
*/
public void loadSoundSettings(GameSettings par1GameSettings) {
this.options = par1GameSettings;
EaglerAdapter.setMusicVolume(options.musicVolume);
EaglerAdapter.setMasterVolume(options.soundVolume);
if(this.sounddefinitions == null) {
this.sounddefinitions = new HashMap();
@ -85,6 +88,8 @@ public class SoundManager {
* Called when one of the sound level options has changed.
*/
public void onSoundOptionsChanged() {
EaglerAdapter.setMusicVolume(options.musicVolume);
EaglerAdapter.fireTitleMusicEvent(titleMusic != -1, options.musicVolume);
EaglerAdapter.setMasterVolume(options.soundVolume);
}
@ -130,10 +135,29 @@ public class SoundManager {
for(EntitySoundEvent e : soundevents) {
EaglerAdapter.endSound(e.id);
}
for(Integer i : activerecords) {
EaglerAdapter.endSound(i.intValue());
}
}
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() {
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() {
if(EaglerAdapter.isPlaying(titleMusic)) {
EaglerAdapter.endSound(titleMusic);
EaglerAdapter.fireTitleMusicEvent(false, this.options.musicVolume);
}
titleMusic = -1;
}

View File

@ -72,6 +72,7 @@ public class Client {
registerErrorHandler();
ServerList.loadDefaultServers(conf);
AssetRepository.loadOverrides(conf);
LocalStorageManager.loadStorage();
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.MouseEvent;
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.HTMLDocument;
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.AudioContext;
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.DecodeSuccessCallback;
import org.teavm.jso.webaudio.GainNode;
@ -99,7 +102,6 @@ import net.lax1dude.eaglercraft.RelayServerSocket;
import net.lax1dude.eaglercraft.RelayWorldsQuery;
import net.lax1dude.eaglercraft.ServerQuery;
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.EaglercraftLANServer;
import net.lax1dude.eaglercraft.adapter.teavm.EaglercraftVoiceClient;
@ -185,6 +187,33 @@ public class EaglerAdapterImpl2 {
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;")
public static native void setDebugVar(String v, String s);
@ -396,6 +425,9 @@ public class EaglerAdapterImpl2 {
masterVolumeNode = audioctx.createGain();
masterVolumeNode.getGain().setValue(1.0f);
masterVolumeNode.connect(audioctx.getDestination());
musicVolumeNode = audioctx.createGain();
musicVolumeNode.getGain().setValue(1.0f);
musicVolumeNode.connect(audioctx.getDestination());
mouseEvents.clear();
keyEvents.clear();
@ -1954,19 +1986,48 @@ public class EaglerAdapterImpl2 {
}
private static int playbackId = 0;
private static int audioElementId = 0;
private static final HashMap<String,AudioBufferX> loadedSoundFiles = new HashMap();
private static AudioContext audioctx = null;
private static GainNode masterVolumeNode = null;
private static GainNode musicVolumeNode = null;
private static float playbackOffsetDelay = 0.03f;
public static final void setPlaybackOffsetDelay(float 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) {
setGainlessAudioVolume(masterVolumeNode.getGain().getValue(), f, false);
masterVolumeNode.getGain().setValue(f);
}
public static final void setMusicVolume(float f) {
setGainlessAudioVolume(musicVolumeNode.getGain().getValue(), f, true);
musicVolumeNode.getGain().setValue(f);
}
@Async
public static native AudioBuffer decodeAudioAsync(ArrayBuffer buffer);
@ -1984,7 +2045,7 @@ 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 final AudioBuffer buffer;
@ -1993,17 +2054,38 @@ public class EaglerAdapterImpl2 {
}
}
private static class AudioBufferSourceNodeX {
private final AudioBufferSourceNode source;
private static class AudioSourceNodeX {
private final PannerNode panner;
private final GainNode gain;
private AudioBufferSourceNodeX(AudioBufferSourceNode source, PannerNode panner, GainNode gain) {
this.source = source;
private final boolean music;
private AudioSourceNodeX(PannerNode panner, GainNode gain, boolean music) {
this.panner = panner;
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) {
AudioBufferX ret = loadedSoundFiles.get(fileName);
if(ret == null) {
@ -2017,11 +2099,30 @@ public class EaglerAdapterImpl2 {
return ret.buffer;
}
public static final int beginPlayback(String fileName, float x, float y, float z, float volume, float pitch) {
return beginPlayback(fileName, x, y, z, volume, pitch, false);
}
public static final int beginPlayback(String fileNamePre, float x, float y, float z, float volume, float pitch, boolean music) {
if(fileNamePre.startsWith("/")) fileNamePre = fileNamePre.substring(1);
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;
AudioBufferSourceNode s = audioctx.createBufferSource();
s.setBuffer(b);
s.getPlaybackRate().setValue(pitch);
s = audioctx.createBufferSource();
((AudioBufferSourceNode) s).setBuffer(b);
((AudioBufferSourceNode) s).getPlaybackRate().setValue(pitch);
}
ChannelMergerNode c = audioctx.createChannelMerger(1);
PannerNode p = audioctx.createPanner();
p.setPosition(x, y, z);
p.setMaxDistance(volume * 16f + 0.1f);
@ -2035,69 +2136,146 @@ public class EaglerAdapterImpl2 {
p.setOrientation(0f, 1f, 0f);
GainNode g = audioctx.createGain();
g.getGain().setValue(volume > 1.0f ? 1.0f : volume);
s.connect(g);
s.connect(c);
c.connect(g);
g.connect(p);
p.connect(masterVolumeNode);
s.start(0.0d, playbackOffsetDelay);
p.connect(music ? musicVolumeNode : masterVolumeNode);
if (!usingUrl) {
((AudioBufferSourceNode) s).start(0.0d, playbackOffsetDelay);
}
final int theId = ++playbackId;
activeSoundEffects.put(theId, new AudioBufferSourceNodeX(s, p, g));
s.setOnEnded(new EventListener<MediaEvent>() {
if (usingUrl) {
activeSoundEffects.put(theId, new MediaElementAudioSourceNodeX((MediaElementAudioSourceNode) s, audioElement, p, g, music));
audioElement.addEventListener("canplay", new EventListener<Event>() {
@Override
public void handleEvent(Event evt) {
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;
}
public static final int beginPlaybackStatic(String fileName, float volume, float pitch) {
return beginPlaybackStatic(fileName, volume, pitch, false);
}
public static final int beginPlaybackStatic(String fileNamePre, float volume, float pitch, boolean music) {
if(fileNamePre.startsWith("/")) fileNamePre = fileNamePre.substring(1);
String fileName = AssetRepository.fileNameOverrides.getOrDefault(fileNamePre, fileNamePre);
AudioNode s = null;
GainNode g = null;
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);
audioElement.setPlaybackRate(pitch);
} else {
AudioBuffer b = getBufferFor(fileName);
if(b == null) return -1;
AudioBufferSourceNode s = audioctx.createBufferSource();
s.setBuffer(b);
s.getPlaybackRate().setValue(pitch);
GainNode g = audioctx.createGain();
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(masterVolumeNode);
s.start(0.0d, playbackOffsetDelay);
final int theId = ++playbackId;
activeSoundEffects.put(theId, new AudioBufferSourceNodeX(s, null, g));
s.setOnEnded(new EventListener<MediaEvent>() {
g.connect(music ? musicVolumeNode : masterVolumeNode);
((AudioBufferSourceNode) s).start(0.0d, playbackOffsetDelay);
}
final int theId = ++playbackId;
if (usingUrl) {
activeSoundEffects.put(theId, new MediaElementAudioSourceNodeX(null, audioElement, null, null, music));
audioElement.addEventListener("canplay", new EventListener<Event>() {
@Override
public void handleEvent(Event evt) {
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 playbackId;
}
return theId;
}
public static final void setPitch(int id, float pitch) {
AudioBufferSourceNodeX b = activeSoundEffects.get(id);
if(b != null) {
b.source.getPlaybackRate().setValue(pitch);
AudioSourceNodeX a = activeSoundEffects.get(id);
if(a != null) {
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) {
AudioBufferSourceNodeX b = activeSoundEffects.get(id);
if(b != null) {
b.gain.getGain().setValue(volume > 1.0f ? 1.0f : volume);
if(b.panner != null) b.panner.setMaxDistance(volume * 16f + 0.1f);
AudioSourceNodeX a = activeSoundEffects.get(id);
if(a != null) {
if (a instanceof MediaElementAudioSourceNodeX && a.gain == null) {
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) {
AudioBufferSourceNodeX b = activeSoundEffects.get(id);
if(b != null && b.panner != null) {
b.panner.setPosition(x, y, z);
//b.panner.setVelocity(vx, vy, vz);
AudioSourceNodeX a = activeSoundEffects.get(id);
if(a != null && a.panner != null) {
a.panner.setPosition(x, y, z);
//a.panner.setVelocity(vx, vy, vz);
}
}
public static final void endSound(int id) {
AudioBufferSourceNodeX b = activeSoundEffects.get(id);
if(b != null) {
b.source.stop();
AudioSourceNodeX a = activeSoundEffects.get(id);
if(a != null) {
if (a instanceof AudioBufferSourceNodeX) {
((AudioBufferSourceNodeX) a).source.stop();
} else if (a instanceof MediaElementAudioSourceNodeX) {
((MediaElementAudioSourceNodeX) a).audio.pause();
((MediaElementAudioSourceNodeX) a).audio.setSrc("");
}
activeSoundEffects.remove(id);
}
}
@ -3771,6 +3949,7 @@ public class EaglerAdapterImpl2 {
rtcLANClient.setRemoteDataChannelHandler(new EaglercraftLANClient.ClientSignalHandler() {
@Override
public void call() {
clientDataChannelClosed = false;
clientDataChannelOpen = true;
}
});
@ -3804,7 +3983,7 @@ public class EaglerAdapterImpl2 {
clientICECandidate = null;
clientDescription = null;
clientDataChannelOpen = false;
clientDataChannelClosed = false;
clientDataChannelClosed = true;
}
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) {
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
restricted: false
origin_blacklist_block_offline_download: false
origin_blacklist_block_missing_origin_header: false
origin_blacklist_block_missing_origin_header: true
permissions:
default:
- bungeecord.command.server
@ -84,7 +84,7 @@ permissions:
- bungeecord.command.eag.blockdomainname
- bungeecord.command.eag.unblockdomain
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
display_ban_type_on_kick: false
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");
}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",
servers: [
{ serverName: "placeholder", serverAddress: "address here", hideAddress: false }
],
relays: [
{ addr: "wss://relay.deev.is/", name: "lax1dude relay #1", primary: true },
{ addr: "wss://relay.lax1dude.net/", name: "lax1dude relay #2" },
{ addr: "wss://relay.shhnowisnottheti.me/", name: "ayunami relay #1" }
{ 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",

View File

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

@ -122,6 +122,19 @@ public class ZipGenerator {
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();
}
private static void zipFolder(ZipOutputStream zOut, String pfx, File file, String... exclude) throws IOException {

Binary file not shown.