Add Minecraft game launch and asset management
Introduces core game logic for launching Minecraft, including asset, library, and Java runtime management. Adds Forge mod support, OS utilities, and file helpers. Updates frontend to handle game launch, log streaming, and UI feedback. Minor bugfixes and style improvements are also included.
This commit is contained in:
@@ -2,6 +2,7 @@ const buttons = document.querySelectorAll("button[frame]")
|
||||
const dynmapFrame = document.querySelector("article.frame.dynmap > iframe")
|
||||
const capesSelector = document.querySelector("article.capes > div.capes")
|
||||
const logsContainer = document.querySelector("div.container.logs")
|
||||
const playButton = document.querySelector("button.play")
|
||||
|
||||
let viewerInstance = new skinview3d.SkinViewer({
|
||||
canvas: document.getElementById("skin"),
|
||||
@@ -231,17 +232,55 @@ window.changeUsername = async function changeUsername(newName) {
|
||||
|
||||
window.gamelog = {}
|
||||
|
||||
window.gamelog.put = async function put(log) {
|
||||
window.gamelog.put = function put(log) {
|
||||
const logElement = document.createElement("p")
|
||||
logElement.innerText = log
|
||||
logsContainer.appendChild(log)
|
||||
logsContainer.appendChild(logElement)
|
||||
}
|
||||
|
||||
window.gamelog.clear = async function clear() {
|
||||
window.gamelog.clear = function clear() {
|
||||
logsContainer.innerHTML = ""
|
||||
}
|
||||
|
||||
window.play = async function play() {
|
||||
gamelog.clear()
|
||||
showLoadingBar()
|
||||
playButton.setAttribute("disabled", "")
|
||||
const gameLaunch = await system.call("launcher::game")
|
||||
if (gameLaunch.success) {
|
||||
hideLoadingBar()
|
||||
} else {
|
||||
hideLoadingBar()
|
||||
playButton.removeAttribute("disabled")
|
||||
}
|
||||
}
|
||||
|
||||
window.external.receiveMessage(message => {
|
||||
try {
|
||||
const data = JSON.parse(message)
|
||||
|
||||
switch (data.requestId) {
|
||||
case "game::log":
|
||||
const logMessage = data.payload.message
|
||||
if (logMessage != "GAME_CLOSED") {
|
||||
console.log("MC:", logMessage)
|
||||
gamelog.put(logMessage)
|
||||
logsContainer.scrollTop = logsContainer.scrollHeight
|
||||
} else {
|
||||
playButton.removeAttribute("disabled")
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Erreur réception message Photino:", e)
|
||||
}
|
||||
})
|
||||
|
||||
await initSkin()
|
||||
await initSettings()
|
||||
await initCapesSelector()
|
||||
hideLoadingBar()
|
||||
showFrame("game")
|
||||
Reference in New Issue
Block a user