aboutsummaryrefslogtreecommitdiff
path: root/codegen/lib/extract.py
diff options
context:
space:
mode:
authorUbuntu <github@matdoes.dev>2023-02-10 01:56:45 +0000
committerUbuntu <github@matdoes.dev>2023-02-10 01:56:45 +0000
commit9d4f738d4e66adf0796e163d1c9368aaba906bba (patch)
treeae7b3c7fca0ff054eb67c1311955e9321a37e559 /codegen/lib/extract.py
parent48b2a37aa09f0302b40d0678cdde2703f919ed18 (diff)
downloadazalea-drasl-9d4f738d4e66adf0796e163d1c9368aaba906bba.tar.xz
make blockstate good
Diffstat (limited to 'codegen/lib/extract.py')
-rwxr-xr-xcodegen/lib/extract.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/codegen/lib/extract.py b/codegen/lib/extract.py
index 7cbeff30..09035e86 100755
--- a/codegen/lib/extract.py
+++ b/codegen/lib/extract.py
@@ -4,6 +4,7 @@ from lib.download import get_server_jar, get_burger, get_client_jar, get_pixlyze
from lib.utils import get_dir_location
from zipfile import ZipFile
import subprocess
+import requests
import json
import sys
import re
@@ -114,7 +115,20 @@ def get_pixlyzer_data(version_id: str, category: str):
target_dir = get_dir_location(f'downloads/pixlyzer-{version_id}')
- if not os.path.exists(get_dir_location(target_dir)):
+ # TODO: right now this False is hard-coded, it should retry with this
+ # enabled if # initially getting the data fails
+ if False or (os.path.exists(target_dir) and not os.path.exists(f'{target_dir}/{category}.min.json')):
+ print('Downloading', category, 'from pixlyzer-data.')
+ data = requests.get(f'https://gitlab.com/Bixilon/pixlyzer-data/-/raw/master/version/{version_id}/{category}.min.json?inline=false').text
+ try:
+ os.mkdir(target_dir)
+ except:
+ pass
+ with open(f'{target_dir}/{category}.min.json', 'w') as f:
+ f.write(data)
+ return json.loads(data)
+
+ if not os.path.exists(target_dir):
pixlyzer_dir = get_pixlyzer()
# for some reason pixlyzer doesn't work right unless the mvn clean
@@ -231,7 +245,6 @@ def get_pixlyzer_data(version_id: str, category: str):
with open(f'{target_dir}/{category}.min.json', 'r') as f:
return json.load(f)
-
def get_file_from_jar(version_id: str, file_dir: str):
get_client_jar(version_id)
with ZipFile(get_dir_location(f'downloads/client-{version_id}.jar')) as z: