Skip to content

Commit 194f971

Browse files
committed
Add new calling method to allow access to all protocols
1 parent 2ea17cd commit 194f971

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

example.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,8 @@
2424

2525
from minecraft_data.v1_8 import version
2626

27-
print(version)
27+
print(version)
28+
29+
import minecraft_data
30+
31+
print(minecraft_data("1.12").version)

minecraft_data/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import os
2+
import sys
3+
4+
from minecraft_data.tools import convert
5+
6+
7+
class mod(sys.modules[__name__].__class__):
8+
def __call__(self, version):
9+
_dir = os.path.join(
10+
os.path.dirname(__file__), "data/data/pc/", version
11+
)
12+
return type(version, (object,), convert(_dir))
13+
14+
15+
sys.modules[__name__].__class__ = mod

0 commit comments

Comments
 (0)