Skip to content
This repository was archived by the owner on Feb 19, 2021. It is now read-only.

Commit a853500

Browse files
committed
MCPI-Docker compatibility, part 1.
1 parent caf5079 commit a853500

File tree

4 files changed

+48
-56
lines changed

4 files changed

+48
-56
lines changed

Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,27 @@
2121

2222
pack:
2323
mkdir -p ./deb/
24+
mkdir -p ./deb/DEBIAN/
2425
cp -a ./res/. ./deb/
2526
mkdir -p ./deb/usr/lib/python3/dist-packages/
27+
mkdir -p ./deb/usr/bin/
2628
cp ./src/mcpil.py ./deb/usr/bin/mcpil
2729
cp ./src/mcpim.py ./deb/usr/lib/python3/dist-packages/
2830
rm -f ./deb/usr/bin/mcpim
2931
ln -s /usr/lib/python3/dist-packages/mcpim.py ./deb/usr/bin/mcpim
30-
chmod a+x ./deb/usr/bin/mcpil
31-
chmod a+x ./deb/usr/bin/mcpim
32+
sudo chmod a+x ./deb/usr/bin/mcpil
33+
sudo chmod a+x ./deb/usr/bin/mcpim
3234
@echo "Package: mcpil" > ./deb/DEBIAN/control
33-
@echo "Version: 0.7.0" >> ./deb/DEBIAN/control
35+
@echo "Version: 0.7.1" >> ./deb/DEBIAN/control
3436
@echo "Priority: optional" >> ./deb/DEBIAN/control
3537
@echo "Architecture: armhf" >> ./deb/DEBIAN/control
36-
@echo "Depends: libmcpi, mcpi-proxy, mcpi-central, libmodpi, libmcpi-docker, python3, minecraft-pi" >> ./deb/DEBIAN/control
38+
@echo "Depends: libmcpi, mcpi-proxy, mcpi-central, libmodpi, libmcpi-docker, python3, libfreeimage3, libglfw3, minecraft-pi" >> ./deb/DEBIAN/control
3739
@echo "Maintainer: Alvarito050506 <[email protected]>" >> ./deb/DEBIAN/control
3840
@echo "Homepage: https://mcpi.tk" >> ./deb/DEBIAN/control
3941
@echo "Vcs-Browser: https://github.com/MCPI-Devs/MCPIL" >> ./deb/DEBIAN/control
4042
@echo "Vcs-Git: https://github.com/MCPI-Devs/MCPIL.git" >> ./deb/DEBIAN/control
4143
@echo "Description: Simple launcher for Minecraft: Pi Edition.\n" >> ./deb/DEBIAN/control
42-
dpkg-deb -b ./deb/ ./mcpil_0.7.0-1.deb
44+
dpkg-deb -b ./deb/ ./mcpil_0.7.1-1.deb
4345

4446
clean:
4547
rm -rf ./deb/

res/usr/bin/minecraft-pe.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

res/usr/bin/minecraft-pi.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/mcpil.py

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import time
3030
import json
3131
import threading
32-
from os import environ, kill, rename, mkdir, uname, getpid
32+
from os import environ, kill, rename, mkdir, uname, getpid, chdir
3333
from tkinter import *
3434
from tkinter import ttk
3535
from tkinter import simpledialog
@@ -42,16 +42,28 @@
4242

4343
descriptions = [
4444
"Classic Miecraft Pi Edition.\nNo mods.",
45-
"Modded Miecraft Pi Edition.\nModPi + libmcpi-docker without Survival or Touch GUI.",
46-
"Minecraft Pocket Edition.\nlibmcpi-docker.",
45+
"Modded Miecraft Pi Edition.\nModPi + MCPI-Docker mods without Survival or Touch GUI.",
46+
"Minecraft Pocket Edition.\nMCPI-Docker mods.",
4747
"Custom Profile.\nModify its settings in the Profile tab.",
4848
];
4949
preset_features = [
5050
str(),
51-
"Fix Bow & Arrow|Fix Attacking|Mob Spawning|Show Clouds|ModPi",
52-
"Touch GUI|Survival Mode|Fix Bow & Arrow|Fix Attacking|Mob Spawning|Show Clouds"
51+
"Fix Bow & Arrow|Fix Attacking|Mob Spawning|Fancy Graphics|Fix Sign Placement|ModPi",
52+
"Touch GUI|Survival Mode|Fix Bow & Arrow|Fix Attacking|Mob Spawning|Fancy Graphics|Disable Autojump By Default|Fix Sign Placement|Show Block Outlines"
53+
];
54+
55+
features = [
56+
"Touch GUI",
57+
"Survival Mode",
58+
"Fix Bow & Arrow",
59+
"Fix Attacking",
60+
"Mob Spawning",
61+
"Fancy Graphics",
62+
"Disable Autojump By Default",
63+
"Fix Sign Placement",
64+
"Show Block Outlines",
65+
"ModPi"
5366
];
54-
features = ["Touch GUI", "Survival Mode", "Fix Bow & Arrow", "Fix Attacking", "Mob Spawning", "Show Clouds", "ModPi"];
5567
enabled_features = str();
5668
home = environ["HOME"];
5769
api_client = APIClient(None);
@@ -61,7 +73,7 @@
6173

6274
class Checkbox(ttk.Checkbutton):
6375
def __init__(self, *args, **kwargs):
64-
super().__init__(*args, **kwargs)
76+
super().__init__(*args, **kwargs);
6577
self.state = BooleanVar(self);
6678
self.configure(variable=self.state);
6779

@@ -71,6 +83,15 @@ def checked(self):
7183
def check(self, val):
7284
return self.state.set(val);
7385

86+
class HyperLink(Label):
87+
def __init__(self, parent, url, text=None, fg=None, cursor=None, *args, **kwargs):
88+
self.url = url;
89+
super().__init__(parent, text=(text or url), fg=(fg or "blue"), cursor=(cursor or "hand2"), *args, **kwargs);
90+
self.bind("<Button-1>", self.web_open);
91+
92+
def web_open(self, event):
93+
return webbrowser.open(self.url);
94+
7495
def basename(path):
7596
return path.split("/")[-1];
7697

@@ -99,6 +120,7 @@ def launch():
99120
environ.update({
100121
"LD_PRELOAD": f"/usr/lib/libmodpi.so:{bk}"
101122
});
123+
chdir("/opt/minecraft-pi");
102124
mcpi_process = subprocess.Popen(["/opt/minecraft-pi/minecraft-pi"]);
103125
environ.update({
104126
"LD_PRELOAD": bk
@@ -171,10 +193,10 @@ def update_dlls():
171193
global dll_files;
172194

173195
dll_files = list();
174-
dll_files = glob("/usr/lib/mcpi-docker/mods/lib*.so");
196+
dll_files = glob("/usr/lib/libmcpi-docker/lib*.so");
175197
bk = environ.get("LD_LIBRARY_PATH") or str();
176198
environ.update({
177-
"LD_LIBRARY_PATH": f"/usr/lib/mcpi-docker:/usr/arm-linux-gnueabihf/lib:{bk}",
199+
"LD_LIBRARY_PATH": f"/opt/minecraft-pi/minecraft-pi/lib/brcm:/usr/lib/libmcpi-docker:/usr/arm-linux-gnueabihf/lib:{bk}",
178200
"LD_PRELOAD": ":".join(dll_files)
179201
});
180202
return 0;
@@ -206,10 +228,6 @@ def enable_central_server():
206228
proxy_thread.start();
207229
return 0;
208230

209-
def web_open(event):
210-
webbrowser.open(event.widget.cget("text"));
211-
return 0;
212-
213231
def save_world():
214232
old_world_name = old_worldname_entry.get();
215233
new_world_name = new_worldname_entry.get();
@@ -275,11 +293,15 @@ def restore_profile():
275293
def add_checkboxes(parent):
276294
global profile_settings;
277295

296+
i = 0;
278297
profile_settings = list();
298+
checkbox_frame = Frame(parent);
279299
for feature in features:
280-
tmp = Checkbox(parent, text=feature);
281-
tmp.pack(fill=BOTH, pady=2, padx=160);
300+
tmp = Checkbox(checkbox_frame, text=feature);
301+
tmp.pack(fill=BOTH, anchor=N, padx=8);
282302
profile_settings.append(tmp);
303+
i += 1;
304+
checkbox_frame.pack(fill=X);
283305
return 0;
284306

285307
def init():
@@ -500,10 +522,7 @@ def profile_tab(parent):
500522
title.config(font=("", 24));
501523
title.pack();
502524

503-
checkbox_frame = Frame(tab);
504-
add_checkboxes(checkbox_frame);
505-
checkbox_frame.pack(fill=BOTH, pady=8, padx=16);
506-
525+
add_checkboxes(tab);
507526
restore_profile();
508527

509528
buttons_frame = Frame(tab);
@@ -519,18 +538,17 @@ def about_tab(parent):
519538
title.config(font=("", 24));
520539
title.pack();
521540

522-
version = Label(tab, text="v0.6.2");
541+
version = Label(tab, text="v0.7.1");
523542
version.config(font=("", 10));
524543
version.pack();
525544

526-
author = Label(tab, text="by @Alvarito050506");
545+
author = HyperLink(tab, "https://github.com/Alvarito050506", text="by @Alvarito050506", fg="black");
527546
author.config(font=("", 10));
528547
author.pack();
529548

530-
url = Label(tab, text="https://github.com/MCPI-Devs/MCPIL", fg="blue", cursor="hand2");
549+
url = HyperLink(tab, "https://github.com/MCPI-Devs/MCPIL");
531550
url.config(font=("", 10));
532551
url.pack();
533-
author.bind("<Button-1>", web_open);
534552
return tab;
535553

536554
def main(args):

0 commit comments

Comments
 (0)