Skip to content

Commit f62f4c3

Browse files
committed
Add support for pocket edition data, fixes #12
1 parent 751d86c commit f62f4c3

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

example.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import minecraft_data
2-
mcd = minecraft_data("1.13.2")
2+
# Java edition minecraft-data
3+
mcd = minecraft_data("1.13")
34

45
print(mcd.version)
56

@@ -11,3 +12,9 @@
1112
print(mcd.windows['minecraft:brewing_stand'])
1213

1314
print(mcd.effects_name['Haste'])
15+
16+
# Pocket Edition minecraft-data
17+
mcd_pe = minecraft_data("1.0", "pe")
18+
19+
print(mcd_pe.version)
20+
print(mcd_pe.find_item_or_block('stone'))

minecraft_data/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66

77
class mod(sys.modules[__name__].__class__):
8-
def __call__(self, version):
8+
def __call__(self, version, edition = 'pc'):
99
_dir = os.path.join(
1010
os.path.dirname(__file__), "data/data/"
1111
)
12-
return type(version, (object,), convert(_dir, version))
12+
return type(version, (object,), convert(_dir, version, edition))
1313

1414

1515
sys.modules[__name__].__class__ = mod

minecraft_data/tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
from glob import glob
44

55

6-
def convert(_dir, version):
6+
def convert(_dir, version, edition ='pc'):
77
fp = open(os.path.join(_dir, 'dataPaths.json'))
88
datapaths = json.load(fp)
99
fp.close()
10-
data = _grabdata(_dir, datapaths['pc'][version])
10+
data = _grabdata(_dir, datapaths[edition][version])
1111
ret = {}
1212
if 'blocks' in data:
1313
ret.update({

0 commit comments

Comments
 (0)