aboutsummaryrefslogtreecommitdiff
path: root/codegen/lib/download.py
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-05-01 21:26:55 -0930
committermat <git@matdoes.dev>2025-05-01 22:12:00 -0845
commitb3f65f9d4b3b625309e5b92aae4221e116e9a068 (patch)
treee3572c2c95af19c7daef9c8ef856aa846ad49101 /codegen/lib/download.py
parent1d3f659c1d304b2a9820feaac063cac3109c2add (diff)
downloadazalea-drasl-b3f65f9d4b3b625309e5b92aae4221e116e9a068.tar.xz
drop dependency on pixlyzer and start using pumpkin extractor
Diffstat (limited to 'codegen/lib/download.py')
-rw-r--r--codegen/lib/download.py45
1 files changed, 37 insertions, 8 deletions
diff --git a/codegen/lib/download.py b/codegen/lib/download.py
index 599e0b72..43ca8d2a 100644
--- a/codegen/lib/download.py
+++ b/codegen/lib/download.py
@@ -22,12 +22,41 @@ def get_burger():
os.system(f'cd {get_dir_location("__cache__")}/Burger && python -m venv venv && venv/bin/pip install six jawa')
-def get_pixlyzer():
- if not os.path.exists(get_dir_location('__cache__/pixlyzer')):
- print('\033[92mDownloading bixilon/pixlyzer...\033[m')
+def get_pumpkin_extractor():
+ if not os.path.exists(get_dir_location('__cache__/pumpkin-extractor')):
+ print('\033[92mDownloading Pumpkin-MC/Extractor...\033[m')
os.system(
- f'cd {get_dir_location("__cache__")} && git clone https://gitlab.bixilon.de/bixilon/pixlyzer.git && cd pixlyzer && git pull')
- return get_dir_location('__cache__/pixlyzer')
+ f'cd {get_dir_location("__cache__")} && git clone https://github.com/Pumpkin-MC/Extractor pumpkin-extractor && cd pumpkin-extractor && git pull')
+
+ GIT_PATCH = '''diff --git a/src/main/kotlin/de/snowii/extractor/extractors/Blocks.kt b/src/main/kotlin/de/snowii/extractor/extractors/Blocks.kt
+index 936cd7b..9876a4b 100644
+--- a/src/main/kotlin/de/snowii/extractor/extractors/Blocks.kt
++++ b/src/main/kotlin/de/snowii/extractor/extractors/Blocks.kt
+@@ -106,12 +106,18 @@ class Blocks : Extractor.Extractor {
+ }
+
+ val collisionShapeIdxsJson = JsonArray()
++ val outlineShapeIdxsJson = JsonArray()
+ for (box in state.getCollisionShape(EmptyBlockView.INSTANCE, BlockPos.ORIGIN).boundingBoxes) {
+ val idx = shapes.putIfAbsent(box, shapes.size)
+ collisionShapeIdxsJson.add(Objects.requireNonNullElseGet(idx) { shapes.size - 1 })
+ }
++ for (box in state.getOutlineShape(EmptyBlockView.INSTANCE, BlockPos.ORIGIN).boundingBoxes) {
++ val idx = shapes.putIfAbsent(box, shapes.size)
++ outlineShapeIdxsJson.add(Objects.requireNonNullElseGet(idx) { shapes.size - 1 })
++ }
+
+ stateJson.add("collision_shapes", collisionShapeIdxsJson)
++ stateJson.add("outline_shapes", outlineShapeIdxsJson)
+
+ for (blockEntity in Registries.BLOCK_ENTITY_TYPE) {
+ if (blockEntity.supports(state)) {
+'''
+ os.system(
+ f'cd {get_dir_location("__cache__")}/pumpkin-extractor && git apply - <<EOF\n{GIT_PATCH}\nEOF'
+ )
+
+ return get_dir_location('__cache__/pumpkin-extractor')
def get_version_manifest():
@@ -181,7 +210,7 @@ def clear_version_cache():
if os.path.exists(burger_path):
os.system(
f'cd {burger_path} && git pull')
- pixlyzer_path = get_dir_location('__cache__/pixlyzer')
- if os.path.exists(pixlyzer_path):
+ pumpkin_path = get_dir_location('__cache__/pumpkin-extractor')
+ if os.path.exists(pumpkin_path):
os.system(
- f'cd {pixlyzer_path} && git pull') \ No newline at end of file
+ f'cd {pumpkin_path} && git add . && git stash && git pull && git stash pop') \ No newline at end of file