#!/bin/bash

# Get dependencies
install_packages curl libx11-6 libxext6 libegl1-mesa zlib1g libstdc++6 libgl1-mesa-dri libasound2 libcom-err2 libgmp10 libp11-kit0 || exit 1

#Download file
mkdir -p ~/.local/bin || error "Could not make directory"
wget -O ~/.local/bin/MCBedrock.AppImage 'https://github.com/minecraft-linux/appimage-builder/releases/download/v0.10.0-716/Minecraft_Bedrock_Launcher-armhf-v0.10.0.716.AppImage' || error "failed to download Minecraft Bedrock Launcher"
chmod +x ~/.local/bin/MCBedrock.AppImage

enable_module fuse || exit 1

#Make Desktop file
mkdir -p ~/.local/share/applications
echo "[Desktop Entry]
Version=1.1
Type=Application
Name=Minecraft Bedrock Launcher
Comment=A Minecraft: Bedrock Edition
Icon=$(dirname "$0")/icon-64.png
Exec=env QTWEBENGINE_CHROMIUM_FLAGS='--enable-logging --log-level=0 --v=3 --single-process --no-sandbox' GALLIUM_HUD=simple,fps $HOME/.local/bin/MCBedrock.AppImage
Categories=Game;
Terminal=false
StartupNotify=true" > ~/.local/share/applications/minecraftbedrock.desktop

