This repository has been archived by the owner on Oct 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__main__.py
99 lines (68 loc) · 2.15 KB
/
__main__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
"""mcpython - a minecraft clone written in python licenced under MIT-licence
authors: uuk, xkcdjerry
original game by forgleman licenced under MIT-licence
minecraft by Mojang
blocks based on 1.14.4.jar of minecraft, downloaded on 20th of July, 2019"""
try:
print("---------------------")
print("- Game Loading Area -")
print("---------------------")
import event.EventHandler
import opengl_setup
import rendering.window
import os
import globals
while os.path.exists(globals.local + "/tmp"):
try:
import shutil
shutil.rmtree(globals.local + "/tmp")
except (shutil.Error, ImportError, FileNotFoundError, PermissionError):
pass
import globals as G
if not os.path.exists(G.local+"/build"):
G.prebuilding = True
os.makedirs(globals.local + "/tmp")
import ResourceLocator
ResourceLocator.load_resources()
import mod.ModLoader
G.modloader.look_out()
G.modloader.sort_mods()
import sys
import setup as systemsetup
import world.World
globals.world = world.World.World()
import texture.model.ModelHandler
import texture.model.BlockState
import tags.TagHandler
import block.BlockHandler
import item.ItemHandler
import world.gen.WorldGenerationHandler
import world.gen.biome.BiomeHandler
def setup():
import globals as G
import world.World
globals.world = world.World.World()
import texture.model.BlockState
import Language
opengl_setup.setup()
import world.gen.mode.DebugOverWorldGenerator
def run():
import pyglet
rendering.window.Window(width=800, height=600, caption='mcpython 4', resizable=True)
G.eventhandler.call("game:gameloop_startup")
pyglet.app.run()
def main():
G.eventhandler.call("game:startup")
setup()
run()
except Exception:
import ResourceLocator
ResourceLocator.close_all_resources()
raise
if __name__ == "__main__":
import sys
try:
main()
finally:
import ResourceLocator
ResourceLocator.close_all_resources()