This commit is contained in:
leha-code 2022-04-27 20:50:55 -04:00
parent 739552017b
commit 87e6e89a5e
No known key found for this signature in database
GPG Key ID: 15227A6455DDF7EE
5 changed files with 33 additions and 363 deletions

View File

@ -72,6 +72,7 @@ from PIL import Image
import darkdetect
import editpi as mcpiedit
import mcpit
# Load dark theme
dark_stylesheet = qdarktheme.load_stylesheet()
@ -148,15 +149,15 @@ class ConfigPluto(QDialog):
) # Button for Pre-installed debs
self.premade_btn.clicked.connect(self.link_appimage) # Connect to the function
self.flatpak_btn = QPushButton(_("Link flatpak")) # Button for linking flatpak
self.flatpak_btn.clicked.connect(self.link_flatpak) # Connect to the function
#self.flatpak_btn = QPushButton(_("Link flatpak")) # Button for linking flatpak
#self.flatpak_btn.clicked.connect(self.link_flatpak) # Connect to the function
# Adding things to widgets
layout.addWidget(titlewidget)
layout.addWidget(info_label)
layout.addWidget(self.executable_btn)
layout.addWidget(self.premade_btn)
layout.addWidget(self.flatpak_btn)
#layout.addWidget(self.flatpak_btn)
self.setLayout(layout)
@ -613,9 +614,16 @@ class Planet(QMainWindow):
self.delete_appimage_button = QPushButton(_("Delete"))
self.delete_appimage_button.clicked.connect(self.delete_appimage)
self.import_gmcpil_button = QPushButton(_("Import settings"))
self.import_gmcpil_button.clicked.connect(self.import_gmcpil)
mcpit_install_label = QLabel(_("Install texture pack"))
self.import_mcpit_button = QPushButton(_("Select file"))
self.import_mcpit_button.clicked.connect(self.install_texture_pack)
mcpit_delete_label = QLabel(_("Delete texture pack"))
self.delete_mcpit_button = QPushButton(_("Delete"))
self.delete_mcpit_button.clicked.connect(mcpit.erase_pack)
layout.addWidget(skin_label, 0, 0)
layout.addWidget(self.skin_button, 0, 1)
@ -625,6 +633,12 @@ class Planet(QMainWindow):
layout.addWidget(appimage_label, 2, 0)
layout.addWidget(self.delete_appimage_button, 2, 1)
layout.addWidget(mcpit_install_label)
layout.addWidget(self.import_mcpit_button, 3, 1)
layout.addWidget(mcpit_delete_label)
layout.addWidget(self.delete_mcpit_button, 4, 1)
widget.setLayout(layout)
@ -727,6 +741,16 @@ class Planet(QMainWindow):
Image.open(filename[0]).crop((0, 0, 64, 32)).convert("RGBA").save(
f"/home/{USER}/.minecraft-pi/overrides/images/mob/char.png"
)
def install_texture_pack(self):
pack = QFileDialog.getOpenFileName(
self, _("Select pack file"), "/", "mcpit files (*.mcpit);;PePack files (*.zip *.pepack)"
)
if pack[1] == "mcpit files (*.mcpit)":
mcpit.mcpit_install(pack[0], False)
else:
mcpit.pepack_install(pack[0])
def delete_config(self):
dialog = QMessageBox()

View File

@ -1,217 +0,0 @@
#!/usr/bin/env python3
"""
MCPiT: Minecraft Pi Edition Texturepack Tool v.1.1
Copyright (C) 2022 Alexey Pavlov
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
from zipfile import *
import os
import shutil
import click
USER = os.getenv("USER")
INDEX = [
# Armor
"chain_1.png",
"chain_2.png",
"cloth_1.png",
"cloth_2.png",
"diamond_1.png",
"diamond_2.png",
"gold_1.png",
"gold_2.png",
"iron_1.png",
"iron_2.png",
# Miscelannous
"kz.png",
"clouds.png",
# Font and GUI
"default8.png",
"background.png",
"bg32.png",
"cursor.png",
"default_world.png",
"gui.png",
"gui2.png",
"gui_blocks.png",
"icons.png",
"itemframe.png",
"items.png", # Items
"pi_title.png",
"spritesheet.png",
"title.png",
"touchgui.png",
"minecon140.png",
"raknet_high_72.png",
"raknet_low_18.png",
# Item entitites
"arrows.png",
"camera.png",
"sign.png",
# Mobs
"chicken.png",
"cow.png",
"creeper.png",
"pig.png",
"pigzombie.png",
"sheep.png",
"sheep_fur.png",
"skeleton.png",
"spider.png",
"zombie.png",
# Misc entities
"particles.png",
# Blocks
"terrain.png",
]
TEXTURE_PATHS = [
"armor/chain_1.png",
"armor/chain_2.png",
"armor/cloth_1.png",
"armor/cloth_2.png",
"armor/diamond_1.png",
"armor/diamond_2.png",
"armor/gold_1.png",
"armor/gold_2.png",
"armor/iron_1.png",
"armor/iron_2.png",
"art/kz.png",
"environment/clouds.png",
"font/default8.png",
"gui/background.png",
"gui/bg32.png",
"gui/cursor.png",
"gui/default_world.png",
"gui/gui.png",
"gui/gui2.png",
"gui/gui_blocks.png",
"gui/icons.png",
"gui/itemframe.png",
"gui/items.png",
"gui/pi_title.png",
"gui/spritesheet.png",
"gui/title.png",
"gui/touchgui.png",
"gui/badge/minecon140.png",
"gui/logo/raknet_high_72.png",
"gui/logo/raknet_low_18.png",
"item/arrows.png",
"item/camera.png",
"item/sign.png",
"mob/chicken.png",
"mob/cow.png",
"mob/creeper.png",
"mob/pig.png",
"mob/pigzombie.png",
"mob/sheep.png",
"mob/sheep_fur.png",
"mob/skeleton.png",
"mob/spider.png",
"mob/zombie.png",
"particles.png",
"terrain.png",
]
def pepack_install(zip_path):
with ZipFile(zip_path) as zip_file:
zip_file.extractall(path=f"/home/{USER}/.minecraft-pi/overrides/")
def mcpit_install(zip_path):
not_found = list()
found = list()
with ZipFile(zip_path) as zip_file:
for file in zip_file.namelist():
if file in INDEX:
found.append(file)
else:
not_found.append(file)
for file in found:
zip_file.extract(
file,
path=f"/home/{USER}/.minecraft-pi/overrides/images/"
+ TEXTURE_PATHS[INDEX.index(file)][: -len(INDEX[INDEX.index(file)])],
)
if "changelog" in zip_file.namelist():
with zip_file.open("changelog") as file:
click.echo(file.read())
if "credits" in zip_file.namelist():
with zip_file.open("credits") as file:
click.echo(file.read())
def install_pack(zip_path, pack_format):
if pack_format == "mcpit":
mcpit_install(zip_path)
elif pack_format == "pepack":
pepack_install(zip_path)
def erase_pack():
shutil.rmtree(f"/home/{USER}/.minecraft-pi/overrides/images")
@click.group()
def main():
pass
@main.command(help="Install a texture pack")
@click.argument("pack_path", type=click.Path(exists=True))
@click.option(
"--mcpit",
"-m",
"pack_format",
is_flag=True,
default=True,
help="Use MCPiT format.",
flag_value="mcpit",
)
@click.option(
"--pepack",
"-p",
"pack_format",
is_flag=True,
default=False,
help="Use PEPack format.",
flag_value="pepack",
)
def install(pack_path, pack_format):
install_pack(pack_path, pack_format)
@main.command(help="Erase the pack files")
def erase():
erase_pack()
@main.command(help="Show version and license")
def version():
click.echo(__doc__)
if __name__ == "__main__":
main()

View File

@ -1,137 +0,0 @@
"""
This file is part of mcpit/Planet.
mcpit/Planet is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
mcpit/Planet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with mcpit/Planet. If not, see <https://www.gnu.org/licenses/>.
"""
from PIL import Image
POSITIONS = {
# Row 1
"grass_carried": (0, 0, 16, 16),
"stone": (16, 0, 32, 16),
"dirt": (32, 0, 48, 16),
"grass_side_carried": (48, 0, 64, 16),
"planks_oak": (64, 0, 80, 16),
"stone_slab_side": (80, 0, 96, 16),
"stone_slab_top": (96, 0, 112, 16),
"brick": (112, 0, 128, 16),
"tnt_side": (128, 0, 144, 16),
"tnt_top": (144, 0, 160, 16),
"tnt_bottom": (160, 0, 176, 16),
"web": (176, 0, 192, 16),
"flower_rose": (192, 0, 208, 16),
"flower_dandelion": (208, 0, 224, 16),
"sapling_oak": (240, 0, 256, 16),
# Row 2
"cobblestone": (0, 16, 16, 32),
"bedrock": (16, 16, 32, 32),
"sand": (32, 16, 48, 32), # I love these blocks
"gravel": (48, 16, 64, 32),
"oak_log": (64, 16, 80, 32),
"oak_log_top": (80, 16, 96, 32),
"iron_block": (96, 16, 112, 32),
"gold_block": (112, 16, 128, 32),
"diamond_block": (128, 16, 144, 32),
"chest_top": (144, 16, 160, 32),
"chest_side": (160, 16, 176, 32),
"chest_front": (176, 16, 192, 32),
"mushroom_red": (192, 16, 208, 32),
"mushroom_brown": (208, 16, 224, 32),
"fire_0_placeholder": (240, 16, 256, 32),
# Row 3
"gold_ore": (0, 32, 16, 48),
"iron_ore": (16, 32, 32, 48),
"coal_ore": (32, 32, 48, 48),
"bookshelf": (48, 32, 64, 48),
"cobblestone_mossy": (64, 32, 80, 48),
"obsidian": (80, 32, 96, 48),
"grass_side": (96, 32, 112, 48),
"tallgrass": (112, 32, 128, 48),
"grass_top": (128, 32, 144, 48),
"crafting_table_top": (176, 32, 192, 48),
"furnace_front": (192, 32, 208, 48),
"furnace_side": (208, 32, 224, 48),
"fire_1_placeholder": (240, 32, 256, 48),
# Row 4
"glass": (16, 48, 32, 64),
"diamond_ore": (32, 48, 48, 64),
"redstone_ore": (48, 48, 64, 64),
"leaves_oak_carried": (64, 48, 80, 64),
"leaves_big_oak_carried": (80, 48, 96, 64),
"stonebrick": (96, 48, 112, 64),
"deadbush": (112, 48, 128, 64),
"shrub": (128, 48, 144, 64),
"crafting_table_side": (176, 48, 192, 64),
"crafting_table_front": (192, 48, 208, 64),
"furnace_front_on": (208, 48, 224, 64),
"furnace_top": (224, 48, 240, 64),
"spruce_sapling": (240, 48, 256, 64),
# Row 5
"white_wool": (0, 64, 16, 80),
"snow": (32, 64, 48, 80),
"ice": (48, 64, 64, 80),
"grass_block_snow": (64, 64, 80, 80),
"cactus_top": (80, 64, 96, 80),
"cactus_side": (96, 64, 112, 80),
"cactus_bottom": (112, 64, 128, 80),
"clay": (128, 64, 144, 80),
"sugarcane_extracted": (144, 64, 160, 80),
"birch_sapling": (240, 64, 256, 80),
# Row 6
"torch": (0, 80, 16, 96),
"oak_door_top": (16, 80, 32, 96),
"iron_door_top": (32, 80, 48, 96),
"ladder": (48, 80, 64, 96),
"oak_trapdoor": (64, 80, 80, 96),
"farmland_moist": (96, 80, 112, 96),
"farmland": (112, 80, 128, 96),
"wheat_stage0": (128, 80, 144, 96),
"wheat_stage1": (144, 80, 160, 96),
"wheat_stage2": (160, 80, 176, 96),
"wheat_stage3": (176, 80, 192, 96),
"wheat_stage4": (192, 80, 208, 96),
"wheat_stage5": (208, 80, 224, 96),
"wheat_stage6": (224, 80, 240, 96),
"wheat_stage7": (240, 80, 256, 96),
# Row 7
"oak_door_bottom": (16, 96, 32, 112),
"iron_door_bottom": (32, 96, 48, 112),
"mossy_stone_bricks": (48, 96, 64, 112),
"cracked_stone_bricks": (64, 96, 80, 112),
"netherrack": (96, 96, 112, 112),
"soul_sand": (112, 96, 128, 112),
"glowstone": (128, 96, 144, 112),
"melon_stem": (240, 96, 256, 112),
# Row 8
"black_wool": (16, 112, 32, 128),
"gray_wool": (32, 112, 48, 128),
"dark_oak_log": (64, 112, 80, 128),
"birch_log": (80, 112, 96, 128),
"attached_melon_stem": (240, 112, 256, 128),
# Row 9
"red_wool": (16, 128, 32, 144),
"pink_wool": (32, 128, 48, 144),
"birch_leaves": (48, 128, 64, 144),
"dark_oak_leaves": (32, 128, 48, 144),
"bed1": (48, 128, 64, 144),
"bed2": (64, 128, 80, 144),
"melon_side": (80, 128, 96, 144),
"melon_top": (96, 128, 112, 144),
"lapis_block": (112, 128, 128, 144),
}
def extract_fire():
pass
if __name__ == "__main__":
with Image.open(
"/usr/lib/minecraft-pi-reborn-client/data/images/terrain.png"
) as img:
region = img.crop(POSITIONS["black_wool"])
region.show()

View File

@ -1,11 +1,11 @@
Package: planet-launcher
Version: 1.2.0pre1
Version: 1.2.0
Architecture: all
Maintainer: mcpiscript <mcpiscript@gmail.com>
Depends: python3-pyqt5, python3:any, python3-pyqt5.qtwebkit, python3-pyqt5.qtsvg, python3-pyqt5.qtwebkit, python3-pyqt5.qtmultimedia, gcc
Replaces: mcpil, mcpil-r, gmcpil, jmcpil
Recommends: python3-pyqtdarkmode, python3-minecraftpi
Provides: pi-nbt, mcpiedit, mcpit
Provides: pi-nbt, mcpiedit, mcpit, editpi
Section: games
Priority: optional
Homepage: https://github.com/mcpiscript/Planet

View File

@ -1,4 +1,4 @@
pip3 install pyqtdarktheme pypresence pillow darkdetect qtwidgets pynbt editpi
pip3 install pyqtdarktheme pypresence pillow darkdetect qtwidgets editpi mcpit
link /usr/lib/planet-launcher/main.py /usr/bin/planet-launcher
chmod 755 /usr/lib/planet-launcher/main.py
link /usr/lib/planet-launcher/assets/misc/planet-launcher.desktop /usr/share/applications/planet-launcher.desktop