-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparkour.py
63 lines (52 loc) · 2 KB
/
parkour.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
from function_writer import *
from reset import Arena
import textwrap
PARKOUR_FUNC_FOLDER = "data/parkour/functions/"
LOAD_FUNC = "reset:{0}/_load"
class Parkour:
def __init__(self, name: str, proper_name: str, author: str, join_pos: BlockPos, extra_effects: list[str] = None) -> None:
self.name = name
self.proper_name = proper_name
self.author = author
self.extra_effects = [] if extra_effects is None else extra_effects
effects = ["effect give @s saturation 999999 10 true\n",
"effect give @s regeneration 999999 10 true\n"]
for effect in self.extra_effects:
effects.append(effect + "\n")
self._parkour = {
"_join": {
COMMANDS: [
"tag @s remove in_hub",
"tag @s add playing_{0}",
"clear @s",
*effects,
"gamemode adventure @s",
f"teleport @s {join_pos}",
f"""tellraw @s [{{{{"text":"Welcome to {self.proper_name} by {self.author}!"}}}}]"""
]
},
"_leave": {
COMMANDS: [
"effect clear @s",
"tag @s remove playing_{0}",
f"teleport @s {SPAWN_COORDINATES}"
]
}
}
def generate(self) -> None:
writer = FuncWriter(PARKOUR_FUNC_FOLDER + f"{self.name}/", self.name)
writer.write_functions(self._parkour)
def mossy_caves():
mossycaves = Parkour("pkcaves", "MossyCaves", "TheDeathlyCow", BlockPos(-32, 61, -738))
mossycaves.generate()
def aqua_temple():
aquatic = Parkour("pkaqua", "AquaticTemple", "Vaipereq", BlockPos(104, 56, -805))
aquatic.generate()
def reflections():
# 16.853 s
reflect = Parkour("pkreflect", "Reflections", "MajorlySourLemon", BlockPos(104, 56, -811))
reflect.generate()
if __name__ == '__main__':
mossy_caves()
aqua_temple()
reflections()