diff --git a/planet/assets/heartempty.png.png b/planet/assets/heartempty.png.png new file mode 100644 index 0000000..8eba659 Binary files /dev/null and b/planet/assets/heartempty.png.png differ diff --git a/planet/assets/heartempty.png.pxo b/planet/assets/heartempty.png.pxo new file mode 100644 index 0000000..0d0974b Binary files /dev/null and b/planet/assets/heartempty.png.pxo differ diff --git a/planet/launcher.py b/planet/launcher.py index aa388c7..ed225e4 100644 --- a/planet/launcher.py +++ b/planet/launcher.py @@ -1,73 +1,33 @@ import subprocess import os -FEATURES = [ - "Touch GUI", - "Fix Bow & Arrow", - "Fix Attacking", - "Force Mob Spawning", - "Fancy Graphics", - "Disable Autojump By Default", - "Display Nametags By Default", - "Fix Sign Placement", - "Show Block Outlines", - "Expand Creative Inventory", - "Remove Creative Mode Restrictions", - "Peaceful Mode", - "Animated Water", - "Remove Invalid Item Background", - 'Disable "gui_blocks" Atlas', - "Smooth Lighting", - "3D Anaglyph", - "Fix Camera Rendering", - "Implement Chat", - "Hide Chat Messages", - "Implement Death Messages", - "Implement Game-Mode Switching", - "Allow Joining Survival Servers", - "Miscellaneous Input Fixes", - 'Bind "Q" Key To Item Dropping', - "Bind Common Toggleable Options To Function Keys", - "Render Selected Item Text", - "External Server Support", - "Load Language Files", - "Implement Sound Engine", - "Close Current Screen On Death", -] -DEFAULT_FEATURES = { - "Touch GUI": True, - "Fix Bow & Arrow": True, - "Fix Attacking": True, - "Force Mob Spawning": False, - "Fancy Graphics": True, - "Disable Autojump By Default": True, - "Display Nametags By Default": True, - "Fix Sign Placement": True, - "Show Block Outlines": True, - "Expand Creative Inventory": True, - "Remove Creative Mode Restrictions": True, - "Peaceful Mode": False, - "Animated Water": True, - "Remove Invalid Item Background": True, - 'Disable "gui_blocks" Atlas': True, - "Smooth Lighting": True, - "3D Anaglyph": False, - "Fix Camera Rendering": True, - "Implement Chat": True, - "Hide Chat Messages": False, - "Implement Death Messages": True, - "Implement Game-Mode Switching": True, - "Allow Joining Survival Servers": True, - "Miscellaneous Input Fixes": True, - 'Bind "Q" Key To Item Dropping': True, - "Bind Common Toggleable Options To Function Keys": True, - "Render Selected Item Text": True, - "External Server Support": True, - "Load Language Files": True, - "Implement Sound Engine": True, - "Close Current Screen On Death": True, -} +def get_features_list() -> list: + features = subprocess.run(["minecraft-pi-reborn-client", '--print-available-feature-flags'], stdout=subprocess.PIPE).stdout.decode('utf-8') + features = features.split("\n") + returnlist = list() + for feature in features: + if feature.startswith("TRUE"): + feature = feature[5:] + if feature.startswith("FALSE"): + feature = feature[6:] + returnlist.append(feature) + + return returnlist + + +def get_features_dict() -> dict: + features = subprocess.run(["minecraft-pi-reborn-client", '--print-available-feature-flags'], stdout=subprocess.PIPE).stdout.decode('utf-8') + features = features.split("\n") + returndict = dict() + for feature in features: + if feature.startswith("TRUE"): + feature = feature[5:] + returndict[feature] = True + if feature.startswith("FALSE"): + feature = feature[6:] + returndict[feature] = False + return returndict def set_username(env, username: str = "StevePi"): @@ -88,7 +48,7 @@ def set_hud(env, options: str = "fps,simple"): return env -def set_options(env, options: dict = DEFAULT_FEATURES): +def set_options(env, options: dict): output = str() for option in options: if options[option]: diff --git a/planet/main.py b/planet/main.py index 2a3fa6f..3c64740 100644 --- a/planet/main.py +++ b/planet/main.py @@ -44,11 +44,12 @@ USER = os.getenv("USER") if not os.path.exists(f"/home/{USER}/.planet-launcher/mods"): os.makedirs(f"/home/{USER}/.planet-launcher/mods") -if os.path.exists(f"/home/{USER}/.gmcpil.json"): - with open(f"/home/{USER}/.gmcpil.json") as f: - DEFAULT_FEATURES = json.loads(f.read())["features"] -else: - DEFAULT_FEATURES = launcher.DEFAULT_FEATURES +#if os.path.exists(f"/home/{USER}/.gmcpil.json"): +# with open(f"/home/{USER}/.gmcpil.json") as f: +# DEFAULT_FEATURES = json.loads(f.read())["features"] +#else: +#TODO: Add a tab with a button to import features from gMCPIL +DEFAULT_FEATURES = launcher.get_features_dict() class Planet(QMainWindow): diff --git a/planet/presets.py b/planet/presets.py deleted file mode 100644 index 1ecd778..0000000 --- a/planet/presets.py +++ /dev/null @@ -1,139 +0,0 @@ -DEFAULT_FEATURES = { - "Touch GUI": True, - "Fix Bow & Arrow": True, - "Fix Attacking": True, - "Force Mob Spawning": False, - "Fancy Graphics": True, - "Disable Autojump By Default": True, - "Display Nametags By Default": True, - "Fix Sign Placement": True, - "Show Block Outlines": True, - "Expand Creative Inventory": True, - "Remove Creative Mode Restrictions": True, - "Peaceful Mode": False, - "Animated Water": True, - "Remove Invalid Item Background": True, - 'Disable "gui_blocks" Atlas': True, - "Smooth Lighting": True, - "3D Anaglyph": False, - "Fix Camera Rendering": True, - "Implement Chat": True, - "Hide Chat Messages": False, - "Implement Death Messages": True, - "Implement Game-Mode Switching": True, - "Allow Joining Survival Servers": True, - "Miscellaneous Input Fixes": True, - 'Bind "Q" Key To Item Dropping': True, - "Bind Common Toggleable Options To Function Keys": True, - "Render Selected Item Text": True, - "External Server Support": True, - "Load Language Files": True, - "Implement Sound Engine": True, - "Close Current Screen On Death": True, -} - -MINIMAL_FEATURES = { - "Touch GUI": True, - "Fix Bow & Arrow": True, - "Fix Attacking": True, - "Force Mob Spawning": False, - "Fancy Graphics": False, - "Disable Autojump By Default": True, - "Display Nametags By Default": True, - "Fix Sign Placement": True, - "Show Block Outlines": True, - "Expand Creative Inventory": True, - "Remove Creative Mode Restrictions": True, - "Peaceful Mode": False, - "Animated Water": False, - "Remove Invalid Item Background": True, - 'Disable "gui_blocks" Atlas': False, - "Smooth Lighting": False, - "3D Anaglyph": False, - "Fix Camera Rendering": True, - "Implement Chat": True, - "Hide Chat Messages": False, - "Implement Death Messages": True, - "Implement Game-Mode Switching": True, - "Allow Joining Survival Servers": True, - "Miscellaneous Input Fixes": True, - 'Bind "Q" Key To Item Dropping': True, - "Bind Common Toggleable Options To Function Keys": True, - "Render Selected Item Text": True, - "External Server Support": True, - "Load Language Files": True, - "Implement Sound Engine": True, - "Close Current Screen On Death": True, -} - -MODDED_MCPE_FEATURES = DEFAULT_FEATURES - -CLASSIC_MCPI = dict() - -MODDED_MCPI = { - "Touch GUI": False, - "Fix Bow & Arrow": True, - "Fix Attacking": True, - "Force Mob Spawning": False, - "Fancy Graphics": True, - "Disable Autojump By Default": True, - "Display Nametags By Default": True, - "Fix Sign Placement": True, - "Show Block Outlines": True, - "Expand Creative Inventory": True, - "Remove Creative Mode Restrictions": True, - "Peaceful Mode": False, - "Animated Water": True, - "Remove Invalid Item Background": True, - 'Disable "gui_blocks" Atlas': True, - "Smooth Lighting": True, - "3D Anaglyph": False, - "Fix Camera Rendering": True, - "Implement Chat": True, - "Hide Chat Messages": False, - "Implement Death Messages": True, - "Implement Game-Mode Switching": True, - "Allow Joining Survival Servers": True, - "Miscellaneous Input Fixes": True, - 'Bind "Q" Key To Item Dropping': True, - "Bind Common Toggleable Options To Function Keys": True, - "Render Selected Item Text": True, - "External Server Support": True, - "Load Language Files": True, - "Implement Sound Engine": True, - "Close Current Screen On Death": True, -} - -PROFILE_3D = { - "Touch GUI": True, - "Fix Bow & Arrow": True, - "Fix Attacking": True, - "Force Mob Spawning": False, - "Fancy Graphics": True, - "Disable Autojump By Default": True, - "Display Nametags By Default": True, - "Fix Sign Placement": True, - "Show Block Outlines": True, - "Expand Creative Inventory": True, - "Remove Creative Mode Restrictions": True, - "Peaceful Mode": False, - "Animated Water": True, - "Remove Invalid Item Background": True, - 'Disable "gui_blocks" Atlas': True, - "Smooth Lighting": True, - "3D Anaglyph": True, - "Fix Camera Rendering": True, - "Implement Chat": True, - "Hide Chat Messages": False, - "Implement Death Messages": True, - "Implement Game-Mode Switching": True, - "Allow Joining Survival Servers": True, - "Miscellaneous Input Fixes": True, - 'Bind "Q" Key To Item Dropping': True, - "Bind Common Toggleable Options To Function Keys": True, - "Render Selected Item Text": True, - "External Server Support": True, - "Load Language Files": True, - "Implement Sound Engine": True, - "Close Current Screen On Death": True, -}