Skin support

This commit is contained in:
leha-code 2022-03-20 13:55:06 -04:00
parent 0cf3035cf8
commit 687a91f587
No known key found for this signature in database
GPG Key ID: 15227A6455DDF7EE
5 changed files with 41 additions and 9 deletions

View File

@ -10,9 +10,11 @@
A better launcher for the Minecraft: Pi Edition Reborn mod.
<br/>
<br/>
<center>
<a href="https://github.com/mcpiscript/Planet/issues">Report Bug</a>
|
<a href="https://github.com/mcpiscript/Planet/issues">Request Feature</a>
</center>
</p>
</p>
@ -50,18 +52,19 @@ And, no launcher supports AppImage, thus Planet is required to run new versions
### gMCPIL vs jMCPIL vs pipan vs Planet
| Feature | Planet | [gMCPIL](https://github.com/mcpi-revival/gmcpil) | [jMCPIL](https://github.com/mcpi-revival/jmcpil) | [pipan](https://github.com/randomsoup/pipan) |
|---------|--------|--------|--------|-------|
| Profile & feature saving | Yes | No | Yes | No |
| Profile & feature saving | Yes | Bullseye only | Yes | No |
| AppImage support | Yes | No | No | No |
| Legacy DEB support | Yes | Yes | Yes | Yes |
| Official MCPi-Revival | No | Yes | Yes | No |
| Tab icons | Yes | No | No | No |
| Maintained | Yes | Yes | No | Yes |
| Maintained | Yes | Yes | No | No |
| Supported on Debian Buster | Yes | No | Yes | Yes |
| Discord RPC | Yes | No | No | No |
| External server support | Yes | Yes | Yes | No |
| Flatpak support | Yes | No | No | No |
| Pre-made profiles | No | Yes | Yes | Yes |
| Easy GUI navigation | Yes | Yes | Yes | No |
| Skin support | Yes | No | No | No |
## Credits
- @leha-code - Creator and maintainer
- @red-exe-engineer - Active contributor

View File

@ -60,6 +60,7 @@ from PyQt5.QtWebKitWidgets import *
# Additional imports
import qdarktheme # Dark style for PyQt5
import pypresence # Discord RPC
from PIL import Image
# Load dark theme
dark_stylesheet = qdarktheme.load_stylesheet()
@ -69,6 +70,9 @@ USER = os.getenv("USER") # Get the username, used for later
# Create the mods directory if it does not exist
if not os.path.exists(f"/home/{USER}/.planet-launcher/mods"):
os.makedirs(f"/home/{USER}/.planet-launcher/mods")
if not os.path.exists(f"/home/{USER}/.minecraft-pi/overrides/images/mob/"):
os.makedirs(f"/home/{USER}/.minecraft-pi/overrides/images/mob/")
# if os.path.exists(f"/home/{USER}/.gmcpil.json"):
# with open(f"/home/{USER}/.gmcpil.json") as f:
@ -231,7 +235,7 @@ class Planet(QMainWindow):
"hidelauncher": True,
"profile": "Modded MCPE",
"render_distance": "Short",
"theme": "QDarkTheme Light",
"theme": "dark",
"discord_rpc": True,
}
@ -252,7 +256,7 @@ class Planet(QMainWindow):
) # Set the window icon
tabs = QTabWidget() # Create the tabs
tabs.setTabPosition(QTabWidget.South) # Select the tab position.
tabs.setTabPosition(QTabWidget.North) # Select the tab position.
tabs.setMovable(True) # Allow tab movement.
# Tab part. Please check every function for more info
@ -349,6 +353,9 @@ class Planet(QMainWindow):
self.profilebox.setCurrentText("Modded MCPE") # Set the current selection
self.showlauncher = QRadioButton("Hide Launcher") # RadioButton used for hiding the launcher
self.skin_button = QPushButton("Select Skin")
self.skin_button.clicked.connect(self.select_skin)
self.playbutton = QPushButton("Play") # The most powerful button
@ -376,9 +383,11 @@ class Planet(QMainWindow):
layout.addWidget(profilelabel, 5, 0)
layout.addWidget(self.profilebox, 5, 4, 1, 2)
layout.addWidget(self.showlauncher, 6, 4, 1, 2)
layout.addWidget(self.showlauncher, 6, 4)
layout.addWidget(self.skin_button, 6, 0)
layout.addWidget(self.playbutton, 8, 5)
layout.addWidget(self.playbutton, 8, 4, 1, 2)
widget = QWidget()
@ -433,6 +442,11 @@ class Planet(QMainWindow):
layout = QGridLayout()
self.serversedit = QTextEdit() # Create a text editing area
if not os.path.exists(f"/home/{USER}/.minecraft-pi/servers.txt"):
with open(f"/home/{USER}/.minecraft-pi/servers.txt") as servers:
servers.write("pbptanarchy.tk")
self.serversedit.textChanged.connect(self.save_servers) # Connect on change to the save function
with open(f"/home/{USER}/.minecraft-pi/servers.txt") as servers:
@ -519,6 +533,16 @@ class Planet(QMainWindow):
def save_servers(self):
with open(f"/home/{USER}/.minecraft-pi/servers.txt", "w") as file:
file.write(self.serversedit.toPlainText())
def select_skin(self):
filename = QFileDialog.getOpenFileName(
self, "Select skin file", "/", "PNG files (*.png)"
)
with open(f"/home/{USER}/.minecraft-pi/overrides/images/mob/char.png", "w") as skin:
skin.write("quick placeholder")
Image.open(filename[0]).crop((0,0,64,32)).convert('RGBA').save(f"/home/{USER}/.minecraft-pi/overrides/images/mob/char.png")
def launch(self):
self.save_profile()
@ -543,8 +567,10 @@ if __name__ == "__main__":
apppath = str()
app = QApplication(sys.argv)
app.setPalette(qdarktheme.load_palette("light"))
if os.path.exists(f"/home/{USER}/.planet-launcher/config.json"):
with open(f"/home/{USER}/.planet-launcher/config.json") as file:
app.setPalette(qdarktheme.load_palette(json.loads(file.read())["theme"]))
if not os.path.exists(f"/home/{USER}/.planet-launcher/minecraft.AppImage"):
pluto = ConfigPluto()
pluto.show()

View File

@ -1,3 +1,4 @@
pyqt5
pyqtdarktheme
pypresence
pillow

View File

@ -3,6 +3,8 @@ Version: 1.0rc4
Architecture: all
Maintainer: mcpiscript <mcpiscript@gmail.com>
Depends: python3-pyqt5, python3:any, python3-pyqt5.qtwebkit, python3-pyqt5.qtsvg, python3-pyqt5.qtwebkit, python3-pyqt5.qtmultimedia
Replaces: mcpil, mcpil-r
Provides: python3-pypresence
Recommends: minecraft-pi-reborn-client, minecraft-pi-reborn-server, python3-pyqtdarkmode, python3-mcpi, python3-minecraft-pi, python3-morpheus-mcpi
Section: games
Priority: optional

View File

@ -1,4 +1,4 @@
pip3 install pyqtdarktheme pypresence
pip3 install pyqtdarktheme pypresence pillow
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/planet-launcher.desktop /usr/share/applications/planet-launcher.desktop