<!DOCTYPE html>



<!--

This file is from ${date}, there is no official eagler download link anymore, check the websites and discords of your favorite eagler servers for new versions

Be aware that some server owners are lazy and do not update their client regularly

Compile it yourself here: https://gitlab.com/lax1dude/eaglercraftx-1.8/

-->













<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="EaglercraftX 1.8 Offline" />
<meta name="keywords" content="eaglercraft, eaglercraftx, minecraft, 1.8, 1.8.8" />
<title>EaglercraftX 1.8</title>
<meta property="og:locale" content="en-US" />
<meta property="og:type" content="website" />
<meta property="og:title" content="EaglercraftX 1.8 Offline" />
<meta property="og:description" content="this file is not a website, whoever uploaded it to this URL is a dumbass" />
<script type="text/javascript">
"use strict";


// %%%%%%%%% launch options %%%%%%%%%%%%

window.eaglercraftXOpts = { container: "game_frame" };

// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


${classes_js}

window.eaglercraftXOpts.assetsURI = ${assets_epk};

var launchInterval = -1;
var launchCounter = 1;
var launchCountdownNumberElement = null;
var launchCountdownProgressElement = null;

function launchTick() {
	launchCountdownNumberElement.innerText = "" + Math.floor(6.0 - launchCounter * 0.06);
	launchCountdownProgressElement.style.width = "" + launchCounter + "%";
	if(++launchCounter > 100) {
		clearInterval(launchInterval);
		setTimeout(() => { document.getElementById("launch_countdown_screen").remove(); main(); }, 50);
	}
}

window.addEventListener("load", () => {
	launchCountdownNumberElement = document.getElementById("launchCountdownNumber");
	launchCountdownProgressElement = document.getElementById("launchCountdownProgress");
	launchInterval = setInterval(launchTick, 50);
});

</script>

<script type="text/javascript">
let controllerIndex = null;

//Left JoyStick
let leftRightAxis1 = 0;
let upDownAxis1 = 0;

//Right JoyStick
let leftRightAxis2 = 0;
let upDownAxis2 = 0;

//in-game controller
let jump = false;
let crouch = false;

window.addEventListener("gamepadconnected", (event) => {
    const gamepad = event.gamepad;
    controllerIndex = gamepad.index;
});

window.addEventListener("gamepaddisconnected",(event) => {
    controllerIndex = null;
});

function handleSticks(axes) {
    updateStick1(axes[0], axes[1]);
    updateStick2(axes[2], axes[3]);
}

function updateStick1(leftRighAxis, upDownAxis) {
    const multiplier = 25;
    const stickLeftRight = leftRighAxis * multiplier;
    const stickUpDown = upDownAxis * multiplier;
    leftRightAxis1 = stickLeftRight;
    upDownAxis1 = stickUpDown;
}

function updateStick2(leftRightAxis, upDownAxis) {
    const multiplier = 25;
    const stickLeftRight = leftRightAxis * multiplier;
    const stickUpDown = upDownAxis * multiplier;
    leftRightAxis2 = stickLeftRight;
    upDownAxis2 = stickUpDown;
}

function controllerConnected() {
    if(controllerIndex != null) {
        return true;
    }
    return false;
}

function handleButtons(buttons) {
    for(let i = 0; i < buttons.length; i++) {
        const button = buttons[i];

        if(button.value > 0) {
            if(i == 0) {
                jump = true;
            }

            if(i == 1) {
                crouch = true;
            }
        }
    }
}

function getCameraX() {
    return leftRightAxis2; 
}

function getCameraY() {
    return upDownAxis2;
}

function isWalkingForward() {
    if(upDownAxis1 < 0) {
        return true;
    }
    return false;
}

function isWalkingBackward() {
    if(upDownAxis1 > 0) {
        return true;
    }
    return false;
}

function isWalkingLeft() {
    if(leftRightAxis1 < 0) {
        return true;
    }
    return false;
}

function isWalkingRight() {
    if(leftRightAxis1 > 0) {
        return true;
    }
    return false;
}

function isKeyDown(buttonID) {
    const gamepad = navigator.getGamepads()[controllerIndex];
    const buttons = gamepad.buttons;
    const button = buttons[buttonID];
    if (gamepad) {
        const buttons = gamepad.buttons;
        const button = buttons[buttonID];
        return button.value > 0;
    }
    return false;
}

function updateController() {
    if(controllerConnected()) {
        if(controllerIndex != null) {
            const gamepad = navigator.getGamepads()[controllerIndex];
            handleSticks(gamepad.axes);
            handleButtons(gamepad.buttons);
        }
    }
}
</script>
<link type="image/png" rel="shortcut icon" href="data:image/png;base64, " />
</head>
<body style="margin:0px;width:100vw;height:100vh;overflow:hidden;" id="game_frame">
<div style="margin:0px;width:100%;height:100%;font-family:sans-serif;display:flex;align-items:center;user-select:none;" id="launch_countdown_screen">
<div style="margin:auto;text-align:center;">
<h1>This file is from <span style="color:#AA0000;">${date}</span></h1>
<h2>Game will launch in <span id="launchCountdownNumber">5</span>...</h2>
<div style="border:2px solid black;width:100%;height:15px;padding:1px;margin-bottom:20vh;"><div id="launchCountdownProgress" style="background-color:#555555;width:0%;height:100%;"></div></div>
</div>
</div>
</body>
</html>

<!--  lax1dude was here  -->
