22w34d Bug fixes & music disc livestream demos

This commit is contained in:
ayunami2000 2022-08-30 00:18:30 -04:00
parent 78e502bb7a
commit effb1cd426
23 changed files with 54654 additions and 54370 deletions

View File

@ -70,7 +70,7 @@ 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.disabledCommands = adapter.getDisabledCommands();

View File

@ -21,6 +21,7 @@ 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;
public class AuthHandler extends PacketHandler {
private static final AuthSystem authSystem = BungeeCord.getInstance().authSystem;
@ -77,6 +78,13 @@ public class AuthHandler extends PacketHandler {
}
}
/*
@Override
public void handle(final PacketFAPluginMessage pm) throws Exception {
this.con.getPendingConnection().handle(pm);
}
*/
@Override
public void handle(final Packet3Chat chat) throws Exception {
String message = chat.getMessage();
@ -137,7 +145,7 @@ 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));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

28
javascript/index.html vendored
View File

@ -4,24 +4,42 @@
<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: {
"records/wait.mp3": "wait.mp3"
"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);
});

View File

@ -6,7 +6,7 @@ public class ConfigConstants {
public static boolean profanity = false;
public static final String version = "22w34c";
public static final String version = "22w34d";
public static final String mainMenuString = "eaglercraft " + version;
public static final String forkMe = "https://github.com/lax1dude/eaglercraft";

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;
@ -69,11 +68,13 @@ 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

@ -5,7 +5,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import net.lax1dude.eaglercraft.AssetRepository;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglercraftRandom;
@ -59,6 +58,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();
@ -82,6 +82,7 @@ public class SoundManager {
*/
public void onSoundOptionsChanged() {
EaglerAdapter.setMusicVolume(options.musicVolume);
EaglerAdapter.fireTitleMusicEvent(titleMusic != -1, options.musicVolume);
EaglerAdapter.setMasterVolume(options.soundVolume);
}
@ -351,12 +352,14 @@ public class SoundManager {
public void playTheTitleMusic() {
if(titleMusic == -1 || !EaglerAdapter.isPlaying(titleMusic)) {
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

@ -102,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;
@ -1989,11 +1988,34 @@ public class EaglerAdapterImpl2 {
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);
}
@ -2026,16 +2048,18 @@ public class EaglerAdapterImpl2 {
private static class AudioSourceNodeX {
private final PannerNode panner;
private final GainNode gain;
private AudioSourceNodeX(PannerNode panner, GainNode gain) {
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) {
super(panner, gain);
private AudioBufferSourceNodeX(AudioBufferSourceNode source, PannerNode panner, GainNode gain, boolean music) {
super(panner, gain, music);
this.source = source;
}
}
@ -2043,12 +2067,15 @@ public class EaglerAdapterImpl2 {
private static class MediaElementAudioSourceNodeX extends AudioSourceNodeX {
private final MediaElementAudioSourceNode source;
private final HTMLAudioElement audio;
private MediaElementAudioSourceNodeX(MediaElementAudioSourceNode source, HTMLAudioElement audio, PannerNode panner, GainNode gain) {
super(panner, gain);
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);
@ -2075,6 +2102,7 @@ public class EaglerAdapterImpl2 {
if (usingUrl) {
audioElement = (HTMLAudioElement) win.getDocument().createElement("audio");
audioElement.setAutoplay(true);
audioElement.setCrossOrigin("anonymous");
audioElement.setSrc(fileName);
s = audioctx.createMediaElementSource(audioElement);
audioElement.setPlaybackRate(pitch);
@ -2108,7 +2136,7 @@ public class EaglerAdapterImpl2 {
}
final int theId = ++playbackId;
if (usingUrl) {
activeSoundEffects.put(theId, new MediaElementAudioSourceNodeX((MediaElementAudioSourceNode) s, audioElement, p, g));
activeSoundEffects.put(theId, new MediaElementAudioSourceNodeX((MediaElementAudioSourceNode) s, audioElement, p, g, music));
audioElement.addEventListener("canplay", new EventListener<Event>() {
@Override
public void handleEvent(Event evt) {
@ -2124,7 +2152,7 @@ public class EaglerAdapterImpl2 {
}
});
} else {
activeSoundEffects.put(theId, new AudioBufferSourceNodeX((AudioBufferSourceNode) s, p, g));
activeSoundEffects.put(theId, new AudioBufferSourceNodeX((AudioBufferSourceNode) s, p, g, music));
((AudioBufferSourceNode) s).setOnEnded(new EventListener<MediaEvent>() {
@Override
public void handleEvent(MediaEvent evt) {
@ -2140,15 +2168,16 @@ public class EaglerAdapterImpl2 {
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;
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);
s = audioctx.createMediaElementSource(audioElement);
audioElement.setPlaybackRate(pitch);
} else {
AudioBuffer b = getBufferFor(fileName);
@ -2156,17 +2185,16 @@ public class EaglerAdapterImpl2 {
s = audioctx.createBufferSource();
((AudioBufferSourceNode) s).setBuffer(b);
((AudioBufferSourceNode) s).getPlaybackRate().setValue(pitch);
}
GainNode g = audioctx.createGain();
g.getGain().setValue(volume > 1.0f ? 1.0f : volume);
s.connect(g);
g.connect(music ? musicVolumeNode : masterVolumeNode);
if (!usingUrl) {
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);
}
final int theId = ++playbackId;
if (usingUrl) {
activeSoundEffects.put(theId, new MediaElementAudioSourceNodeX(((MediaElementAudioSourceNode) s), audioElement, null, g));
activeSoundEffects.put(theId, new MediaElementAudioSourceNodeX(null, audioElement, null, null, music));
audioElement.addEventListener("canplay", new EventListener<Event>() {
@Override
public void handleEvent(Event evt) {
@ -2182,7 +2210,7 @@ public class EaglerAdapterImpl2 {
}
});
} else {
activeSoundEffects.put(theId, new AudioBufferSourceNodeX(((AudioBufferSourceNode) s), null, g));
activeSoundEffects.put(theId, new AudioBufferSourceNodeX(((AudioBufferSourceNode) s), null, g, music));
((AudioBufferSourceNode) s).setOnEnded(new EventListener<MediaEvent>() {
@Override
public void handleEvent(MediaEvent evt) {
@ -2205,8 +2233,22 @@ public class EaglerAdapterImpl2 {
public static final void setVolume(int id, float volume) {
AudioSourceNodeX a = activeSoundEffects.get(id);
if(a != null) {
a.gain.getGain().setValue(volume > 1.0f ? 1.0f : volume);
if(a.panner != null) a.panner.setMaxDistance(volume * 16f + 0.1f);
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) {
@ -3858,7 +3900,7 @@ public class EaglerAdapterImpl2 {
private static String clientICECandidate = null;
private static String clientDescription = null;
private static boolean clientDataChannelOpen = false;
private static boolean clientDataChannelClosed = false;
private static boolean clientDataChannelClosed = true;
public static final boolean clientLANSupported() {
return rtcLANClient.LANClientSupported();

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

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

@ -121,6 +121,19 @@ public class ZipGenerator {
IOUtils.write(FileUtils.readFileToByteArray(new File("zip-generator/repl_index.html")), zOut);
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.