diff --git a/flake.nix b/flake.nix index 55c8d2a..fba329c 100644 --- a/flake.nix +++ b/flake.nix @@ -90,7 +90,22 @@ in { devShell = with pkgs; mkShell { - buildInputs = [ nixfmt git-lfs ]; + buildInputs = [ + nixfmt + git-lfs + + # For the minecraft mod update script + (python3.withPackages (pypkgs: + with pypkgs; [ + requests + + ipython + python-language-server + pyls-black + pyls-isort + pyls-mypy + ])) + ]; shellHook = '' export QEMU_OPTS="-m 3941 -smp 2 -curses" export QEMU_NET_OPTS="hostfwd=::3022-:2222,hostfwd=::3080-:80,hostfwd=::3443-:443,hostfwd=::3021-:2221,hostfwd=::25565-:25565" diff --git a/pkgs/build-support/fetchFromCurseForge.nix b/pkgs/build-support/fetchFromCurseForge.nix index 4fde62e..5d4f232 100644 --- a/pkgs/build-support/fetchFromCurseForge.nix +++ b/pkgs/build-support/fetchFromCurseForge.nix @@ -10,11 +10,11 @@ let # # Note that if it's zero-prefixed we need to remove the zeroes. It's # really an odd one... - a = head (match "0*([[:digit:]]+)" (substring 0 4 id)); - b = head (match "0*([[:digit:]]+)" (substring 4 7 id)); + a = head (match "0*([[:digit:]]+)" (substring 0 4 (toString id))); + b = head (match "0*([[:digit:]]+)" (substring 4 7 (toString id))); url = "https://media.forgecdn.net/files/${a}/${b}/${filename}"; - otherArgs = removeAttrs args [ "project" "id" "filename" ]; + otherArgs = removeAttrs args [ "project" "project_id" "id" "filename" ]; in fetchurl (otherArgs // { inherit url; diff --git a/pkgs/minecraft/voor-kia/mods.json b/pkgs/minecraft/voor-kia/mods.json index db5efa7..43adbd0 100644 --- a/pkgs/minecraft/voor-kia/mods.json +++ b/pkgs/minecraft/voor-kia/mods.json @@ -1,512 +1,597 @@ [ { "project": "ai-improvements", - "id": "3031978", + "id": 3031978, "filename": "AI-Improvements-1.16.2-0.3.0.jar", - "sha256": "47526292ea2f11dd18a8da8863b40ba81a93601f03aa4abcc742ac62ea599c69" + "sha256": "47526292ea2f11dd18a8da8863b40ba81a93601f03aa4abcc742ac62ea599c69", + "project_id": 233019 }, { "project": "alexs-mobs", - "id": "3230693", + "id": 3230693, "filename": "alexsmobs-1.7.1.jar", - "sha256": "e8066d512f53b80a796e5b83db27246aa5fe4b055929475e7efe5ff6dd090f42" + "sha256": "e8066d512f53b80a796e5b83db27246aa5fe4b055929475e7efe5ff6dd090f42", + "project_id": 426558 }, { "project": "apotheosis", - "id": "3095843", + "id": 3095843, "filename": "Apotheosis-1.16.3-4.4.1.jar", - "sha256": "de5ed7501bc17196cca7bddabace3464cbdbf8afba63385d260804ad013ba836" + "sha256": "de5ed7501bc17196cca7bddabace3464cbdbf8afba63385d260804ad013ba836", + "project_id": 313970 }, { "project": "appleskin", - "id": "3035787", + "id": 3035787, "filename": "AppleSkin-mc1.16.2-forge-1.0.14.jar", - "sha256": "e0d39f6b138e853d6171bd51fa158545d68cab5e718a01feb919d37964e5eb4f" + "sha256": "e0d39f6b138e853d6171bd51fa158545d68cab5e718a01feb919d37964e5eb4f", + "project_id": 248787 }, { "project": "architectury-forge", - "id": "3208686", + "id": 3208686, "filename": "architectury-1.7.117-forge.jar", - "sha256": "6cdbdb32b958ca5cec46c92eaa3c5d2c33404b20f5080bc7c612ba7e3fa4bf57" + "sha256": "6cdbdb32b958ca5cec46c92eaa3c5d2c33404b20f5080bc7c612ba7e3fa4bf57", + "project_id": 419699 }, { "project": "artifacts", - "id": "3208854", + "id": 3208854, "filename": "Artifacts-1.16.5-2.8.1.jar", - "sha256": "6c74163a75a2303b3fce04c098efad6de0c345059e279a7e5858a1200779d423" + "sha256": "6c74163a75a2303b3fce04c098efad6de0c345059e279a7e5858a1200779d423", + "project_id": 312353 }, { "project": "attributefix", - "id": "3170246", + "id": 3170246, "filename": "AttributeFix-1.16.5-10.0.1.jar", - "sha256": "8492d282ca55c1e01fad6fd4ae8bd66e418128ccf9044a150af7b4526e02d906" + "sha256": "8492d282ca55c1e01fad6fd4ae8bd66e418128ccf9044a150af7b4526e02d906", + "project_id": 280510 }, { "project": "autoreglib", - "id": "3128555", + "id": 3128555, "filename": "AutoRegLib-1.6-47.jar", - "sha256": "bacb22ec651ca70462e0128d6e6e800cee69b125cd078b9cf6d3a45de3e403fc" + "sha256": "bacb22ec651ca70462e0128d6e6e800cee69b125cd078b9cf6d3a45de3e403fc", + "project_id": 250363 }, { "project": "bedspreads", - "id": "3118466", + "id": 3118466, "filename": "bedspreads-forge-1.16.4-5.1.0.1.jar", - "sha256": "7844407085109d10ba87faf21816fb89fc411ff82ea7f0b761e2bd4f987987d2" + "sha256": "7844407085109d10ba87faf21816fb89fc411ff82ea7f0b761e2bd4f987987d2", + "project_id": 308653 }, { "project": "better-burning", - "id": "3181436", + "id": 3181436, "filename": "BetterBurning-1.16.5-6.0.2.jar", - "sha256": "e81297506876a623e9e770222d6c053eb33ac5451a3905454c2befd69115ae19" + "sha256": "e81297506876a623e9e770222d6c053eb33ac5451a3905454c2befd69115ae19", + "project_id": 353434 }, { "project": "yungs-better-caves", - "id": "3170047", + "id": 3170047, "filename": "BetterCaves-Forge-1.16.4-1.1.1.jar", - "sha256": "f5bc8ba0f46acab08e79f95e8ff980b2629fd678ea25e9068d2d96823c1ba983" + "sha256": "f5bc8ba0f46acab08e79f95e8ff980b2629fd678ea25e9068d2d96823c1ba983", + "project_id": 340583 }, { "project": "yungs-better-mineshafts-forge", - "id": "3175671", + "id": 3175671, "filename": "BetterMineshafts-Forge-1.16.4-2.0.1.jar", - "sha256": "a640f45962f8a1abc60f83c8632e558b541b6ba0238d6297912814dec2d0bdc7" + "sha256": "a640f45962f8a1abc60f83c8632e558b541b6ba0238d6297912814dec2d0bdc7", + "project_id": 389665 }, { "project": "yungs-better-portals", - "id": "3221299", + "id": 3221299, "filename": "BetterPortals-1.16.4-0.3.1.jar", - "sha256": "a86ddf3cbc066d15562e4136717d061861dfb77a2da7b4f112a2b290073c47d9" + "sha256": "a86ddf3cbc066d15562e4136717d061861dfb77a2da7b4f112a2b290073c47d9", + "project_id": 443723 }, { "project": "bookshelf", - "id": "3170154", + "id": 3170154, "filename": "Bookshelf-1.16.5-10.0.1.jar", - "sha256": "33bade36884a25cbf3bac3bdd2e762a2c5fcc1840f613ab5aaaf57642ffc0c68" + "sha256": "33bade36884a25cbf3bac3bdd2e762a2c5fcc1840f613ab5aaaf57642ffc0c68", + "project_id": 228525 }, { "project": "bad-wither-no-cookie-reloaded", - "id": "3101531", + "id": 3101531, "filename": "bwncr-1.16.4-3.9.16.jar", - "sha256": "91c4df24466b958d36d41ce886e5d8b0839a07b73d58248a0dcb84a67279b81f" + "sha256": "91c4df24466b958d36d41ce886e5d8b0839a07b73d58248a0dcb84a67279b81f", + "project_id": 261251 }, { "project": "oh-the-biomes-youll-go", - "id": "3197729", + "id": 3197729, "filename": "byg-1.1.10.jar", - "sha256": "28db347d22ea27167cdbf107180b01b53003d98739189a66ef6c1e4f21e4b436" + "sha256": "28db347d22ea27167cdbf107180b01b53003d98739189a66ef6c1e4f21e4b436", + "project_id": 247560 }, { "project": "callable-horses", - "id": "3090832", + "id": 3090832, "filename": "callablehorses-1.16.3-1.2.1.4.jar", - "sha256": "639778fd58667aa560d333a2490352e34c1c32e897d9f8204e52df305ca5e879" + "sha256": "639778fd58667aa560d333a2490352e34c1c32e897d9f8204e52df305ca5e879", + "project_id": 331746 }, { "project": "citadel", - "id": "3198842", + "id": 3198842, "filename": "citadel-1.6.1.jar", - "sha256": "e13434097199a926a565a109b5c7b82b5e0308efa88dbc2a4d030d78d8f1ac37" + "sha256": "e13434097199a926a565a109b5c7b82b5e0308efa88dbc2a4d030d78d8f1ac37", + "project_id": 331936 }, { "project": "cloth-config-forge", - "id": "3203817", + "id": 3203817, "filename": "cloth-config-4.10.13-forge.jar", - "sha256": "d47bf12ed961fac529064254931308d1ca20d08f411718563827141175daf32b" + "sha256": "d47bf12ed961fac529064254931308d1ca20d08f411718563827141175daf32b", + "project_id": 348521 }, { "project": "clumps", - "id": "3205705", + "id": 3205705, "filename": "Clumps-6.0.0.17.jar", - "sha256": "a9535cf8df267bb2e2ffb46a278aa67f4b6e447d0bc1140205f98257dc108d58" + "sha256": "a9535cf8df267bb2e2ffb46a278aa67f4b6e447d0bc1140205f98257dc108d58", + "project_id": 256717 }, { "project": "codechicken-lib-1-8", - "id": "3175750", + "id": 3175750, "filename": "CodeChickenLib-1.16.4-3.5.1.408-universal.jar", - "sha256": "6b88e5f13ceb642734d3f3168da706a80ae2a2d538ba8dd958eb73b3d8911ab3" + "sha256": "6b88e5f13ceb642734d3f3168da706a80ae2a2d538ba8dd958eb73b3d8911ab3", + "project_id": 242818 }, { "project": "cooking-for-blockheads", - "id": "3098223", + "id": 3098223, "filename": "CookingForBlockheads_1.16.3-9.2.2.jar", - "sha256": "5b15a1e4bac72160ed1ef1042c2cef5eeca5d8dbfecb6620511caa1cf644adaa" + "sha256": "5b15a1e4bac72160ed1ef1042c2cef5eeca5d8dbfecb6620511caa1cf644adaa", + "project_id": 231484 }, { "project": "cosmetic-armor-reworked", - "id": "3205904", + "id": 3205904, "filename": "CosmeticArmorReworked-1.16.5-v1b.jar", - "sha256": "6535b9077d0b64c2cc3392c145f558492c47280eb4a38672c6b6a4897fee7ec7" + "sha256": "6535b9077d0b64c2cc3392c145f558492c47280eb4a38672c6b6a4897fee7ec7", + "project_id": 237307 }, { "project": "crafting-station", - "id": "3084325", + "id": 3084325, "filename": "craftingstation-4.1.1.jar", - "sha256": "a3516650a1c5e76b47b9efd69a4cfa9cda4f85250bf217fa7186f74ef375a7e4" + "sha256": "a3516650a1c5e76b47b9efd69a4cfa9cda4f85250bf217fa7186f74ef375a7e4", + "project_id": 318551 }, { "project": "create", - "id": "3167531", + "id": 3167531, "filename": "create-mc1.16.3_v0.3e.jar", - "sha256": "8c24ee59c3d1c74fb2047564d0aa6935862b2b85fb478dadf19798f7cc08944f" + "sha256": "8c24ee59c3d1c74fb2047564d0aa6935862b2b85fb478dadf19798f7cc08944f", + "project_id": 328085 }, { "project": "creativecore", - "id": "3128357", + "id": 3128357, "filename": "CreativeCore_v2.0.10_mc1.16.4.jar", - "sha256": "85210df1f6abe5befc7afbb9150e5639f885c229ba3018bd6f40fd142468f377" + "sha256": "85210df1f6abe5befc7afbb9150e5639f885c229ba3018bd6f40fd142468f377", + "project_id": 257814 }, { "project": "curios", - "id": "3186427", + "id": 3186427, "filename": "curios-forge-1.16.5-4.0.4.0.jar", - "sha256": "4d6d63c432e24d295a410ec9eb24054123094db4913e76f564adfa188cf59d29" + "sha256": "4d6d63c432e24d295a410ec9eb24054123094db4913e76f564adfa188cf59d29", + "project_id": 309927 }, { "project": "dank-storage", - "id": "3161863", + "id": 3161863, "filename": "dankstorage-3.14.jar", - "sha256": "2ff74a22f0a90f9daed9a0632133b14868ad47500f378326f2a0faedc6029684" + "sha256": "2ff74a22f0a90f9daed9a0632133b14868ad47500f378326f2a0faedc6029684", + "project_id": 335673 }, { "project": "decorative-blocks", - "id": "3166283", + "id": 3166283, "filename": "decorative_blocks-1.16.4-1.7.2.jar", - "sha256": "f12dbfe76e36cdec65b8a575fc671f0291323a0de5ff420ff196d16bd19e6f84" + "sha256": "f12dbfe76e36cdec65b8a575fc671f0291323a0de5ff420ff196d16bd19e6f84", + "project_id": 362528 }, { "project": "doggy-talents", - "id": "3203941", + "id": 3203941, "filename": "DoggyTalents-1.16.4-2.0.1.3.jar", - "sha256": "59d8c5f058ef329bf6363fa8d300da3e876c523f9cc6229e0524317207442489" + "sha256": "59d8c5f058ef329bf6363fa8d300da3e876c523f9cc6229e0524317207442489", + "project_id": 271050 }, { "project": "easy-piglins", - "id": "3169792", + "id": 3169792, "filename": "easy_piglins-1.16.5-1.0.0.jar", - "sha256": "b048630085695a5e8846cc2b8cc1bb6f1bcb59f0077ab63394a803c905df1006" + "sha256": "b048630085695a5e8846cc2b8cc1bb6f1bcb59f0077ab63394a803c905df1006", + "project_id": 419372 }, { "project": "easy-villagers", - "id": "3171686", + "id": 3171686, "filename": "easy_villagers-1.16.4-1.1.28.jar", - "sha256": "3b8eff14b2b83f5cfe178f03076fa37c49add5dc05836b3151c7077f65a96dff" + "sha256": "3b8eff14b2b83f5cfe178f03076fa37c49add5dc05836b3151c7077f65a96dff", + "project_id": 400514 }, { "project": "enchantment-descriptions", - "id": "3191059", + "id": 3191059, "filename": "EnchantmentDescriptions-1.16.5-7.0.2.jar", - "sha256": "890db07c51b07fb5921c8ae9e6352987c705625ca27f3d23bdfd313115a6a94b" + "sha256": "890db07c51b07fb5921c8ae9e6352987c705625ca27f3d23bdfd313115a6a94b", + "project_id": 250419 }, { "project": "ender-storage-1-8", - "id": "3175751", + "id": 3175751, "filename": "EnderStorage-1.16.4-2.7.1.166-universal.jar", - "sha256": "fbb861b85858f7a118a442d5577a53e5415c1f1b6ba7c4ade942d5512706f40d" + "sha256": "fbb861b85858f7a118a442d5577a53e5415c1f1b6ba7c4ade942d5512706f40d", + "project_id": 245174 }, { "project": "extended-lights-mod", - "id": "3144281", + "id": 3144281, "filename": "extlights-3.3.jar", - "sha256": "7f210f8e8bc451df301a6a2c22f81e434dd1835699444e5c0ed2bb2620847a6b" + "sha256": "7f210f8e8bc451df301a6a2c22f81e434dd1835699444e5c0ed2bb2620847a6b", + "project_id": 335051 }, { "project": "extrastorage", - "id": "3179402", + "id": 3179402, "filename": "ExtraStorage-1.16.4-1.3.1.jar", - "sha256": "30a78eb59482d393c7471a3b834e49e2dc6a70998be8ece9ba2c487abb5c92a5" + "sha256": "30a78eb59482d393c7471a3b834e49e2dc6a70998be8ece9ba2c487abb5c92a5", + "project_id": 410168 }, { "project": "farming-for-blockheads", - "id": "3098206", + "id": 3098206, "filename": "FarmingForBlockheads_1.16.3-7.2.1.jar", - "sha256": "2225906be3306bb1066b58ebb97b998ebb679ef7fc2dcab6be53129675c44867" + "sha256": "2225906be3306bb1066b58ebb97b998ebb679ef7fc2dcab6be53129675c44867", + "project_id": 261924 }, { "project": "fast-leaf-decay", - "id": "3052146", + "id": 3052146, "filename": "FastLeafDecay-v25.jar", - "sha256": "0abd12217bd7e83d5427a4aca6acec27241bb4a7272ef79958a692bd60fe1d86" + "sha256": "0abd12217bd7e83d5427a4aca6acec27241bb4a7272ef79958a692bd60fe1d86", + "project_id": 230976 }, { "project": "fastworkbench", - "id": "3171218", + "id": 3171218, "filename": "FastWorkbench-1.16.4-4.5.0.jar", - "sha256": "0f4dc32d33512193a3f53ef4e2432bce921ffc047590e1734d3763b8dbd0a547" + "sha256": "0f4dc32d33512193a3f53ef4e2432bce921ffc047590e1734d3763b8dbd0a547", + "project_id": 288885 }, { "project": "fishing-real", - "id": "3074201", + "id": 3074201, "filename": "fishingreal-1.16.3-1.0.0.jar", - "sha256": "1c2f868ee221e59407f6c8f1ec07fa7ccca49a819559dad818713a6778291fc5" + "sha256": "1c2f868ee221e59407f6c8f1ec07fa7ccca49a819559dad818713a6778291fc5", + "project_id": 348834 }, { "project": "hardcore-revival", - "id": "3066098", + "id": 3066098, "filename": "HardcoreRevival_1.16.3-5.2.0.jar", - "sha256": "c7d20cad7f9d5e9dd36252c3735568b8e7a9a214bc543356b8429b6748f5ae49" + "sha256": "c7d20cad7f9d5e9dd36252c3735568b8e7a9a214bc543356b8429b6748f5ae49", + "project_id": 274036 }, { "project": "ice-and-fire-dragons", - "id": "3162719", + "id": 3162719, "filename": "iceandfire-2.1.5-1.16.4.jar", - "sha256": "eb67d6808d9ae4d32b92d26a9a4561549e5e3fbeacf23ed614b19786c2172c76" + "sha256": "eb67d6808d9ae4d32b92d26a9a4561549e5e3fbeacf23ed614b19786c2172c76", + "project_id": 264231 }, { "project": "ichunutil", - "id": "3062089", + "id": 3062089, "filename": "iChunUtil-1.16.3-10.0.0.jar", - "sha256": "015b4cb31362e323ccdd84e3f865137bd7c32a8a1adcb9f9b77c4e6301a56a25" + "sha256": "015b4cb31362e323ccdd84e3f865137bd7c32a8a1adcb9f9b77c4e6301a56a25", + "project_id": 229060 }, { "project": "iron-chests", - "id": "3105315", + "id": 3105315, "filename": "ironchest-1.16.4-11.2.10.jar", - "sha256": "5208572a3f07647ca3cfed9f7414957acd0059b7f708d2518f4c73c98beae6be" + "sha256": "5208572a3f07647ca3cfed9f7414957acd0059b7f708d2518f4c73c98beae6be", + "project_id": 228756 }, { "project": "iron-furnaces", - "id": "3152441", + "id": 3152441, "filename": "ironfurnaces-1.16.4-2.5.6.jar", - "sha256": "042dcb6eca515f814b2093a600cca23a42fef71e4dbaf53b301369018ac5f288" + "sha256": "042dcb6eca515f814b2093a600cca23a42fef71e4dbaf53b301369018ac5f288", + "project_id": 237664 }, { "project": "jei", - "id": "3192904", + "id": 3192904, "filename": "jei-1.16.4-7.6.1.71.jar", - "sha256": "a4f1cc91214605b7d9b840a4a8ffd910c0eccc9db7f6ce82964bba9f3ca661e5" + "sha256": "a4f1cc91214605b7d9b840a4a8ffd910c0eccc9db7f6ce82964bba9f3ca661e5", + "project_id": 238222 }, { "project": "jei-integration", - "id": "3202331", + "id": 3202331, "filename": "jeiintegration_1.16.5-7.0.1.15.jar", - "sha256": "0b45fe2858a8e9f97bf10fb218975a48a7d228ca27d274194c4dfaa91534bdfd" + "sha256": "0b45fe2858a8e9f97bf10fb218975a48a7d228ca27d274194c4dfaa91534bdfd", + "project_id": 265917 }, { "project": "just-enough-resources-jer", - "id": "3066754", + "id": 3066754, "filename": "JustEnoughResources-1.16.3-0.12.0.100.jar", - "sha256": "d09fe055704075044e76e38c315ef410b8fc3587b1e24e500d540b57365ceb66" + "sha256": "d09fe055704075044e76e38c315ef410b8fc3587b1e24e500d540b57365ceb66", + "project_id": 240630 }, { "project": "kiwi", - "id": "3103509", + "id": 3103509, "filename": "Kiwi-1.16.3-3.4.1.jar", - "sha256": "8e03a2109cb60117f6020a8943a19dc354a2cf2e1b83a0523169fece4ef06757" + "sha256": "8e03a2109cb60117f6020a8943a19dc354a2cf2e1b83a0523169fece4ef06757", + "project_id": 303657 }, { "project": "lollipop", - "id": "3209431", + "id": 3209431, "filename": "Lollipop-1.16.4-3.2.6.jar", - "sha256": "5eb4c5c6947cfdcd26014a3209aff91653fe13044436dbfd0c310bcbf8abf701" + "sha256": "5eb4c5c6947cfdcd26014a3209aff91653fe13044436dbfd0c310bcbf8abf701", + "project_id": 347954 }, { "project": "lotta-terracotta", - "id": "3186253", + "id": 3186253, "filename": "lottaterracotta-1.16.5-1.3.1.jar", - "sha256": "8a5879733d8c35129c999d6524f0b7c1b49482076e1104c0c873f70267ea22d5" + "sha256": "8a5879733d8c35129c999d6524f0b7c1b49482076e1104c0c873f70267ea22d5", + "project_id": 351060 }, { "project": "macaws-doors", - "id": "3182357", + "id": 3182357, "filename": "mcw-doors-1.0.2-mc1.16.5.jar", - "sha256": "cea684ad9bf1fa75ba2685b3e521b2e1806f428681f7d929e3f937b161fb397e" + "sha256": "cea684ad9bf1fa75ba2685b3e521b2e1806f428681f7d929e3f937b161fb397e", + "project_id": 378646 }, { "project": "macaws-furniture", - "id": "3182349", + "id": 3182349, "filename": "mcw-furniture-2.0.1-mc1.16.5.jar", - "sha256": "7f81b95c128ce97f3c41e29a4e98618c591f96321b53b718b5c3b6b8d3cb619e" + "sha256": "7f81b95c128ce97f3c41e29a4e98618c591f96321b53b718b5c3b6b8d3cb619e", + "project_id": 359540 }, { "project": "metal-barrels", - "id": "3055811", + "id": 3055811, "filename": "metalbarrels-3.3a.jar", - "sha256": "9bec62579ec71be41a303519e3b7944df0f3ee23a5b03ac7c0d0b27fe7c66150" + "sha256": "9bec62579ec71be41a303519e3b7944df0f3ee23a5b03ac7c0d0b27fe7c66150", + "project_id": 324985 }, { "project": "pams-harvestcraft-2-crops", - "id": "3076451", + "id": 3076451, "filename": "pamhc2crops-1.16.3-1.0.1.jar", - "sha256": "d987b59e46c36c3461ee913729e9eb3d808e3e2c71499ef6e517c1b3f55ee093" + "sha256": "d987b59e46c36c3461ee913729e9eb3d808e3e2c71499ef6e517c1b3f55ee093", + "project_id": 361385 }, { "project": "pams-harvestcraft-2-food-core", - "id": "3190867", + "id": 3190867, "filename": "pamhc2foodcore-1.16.3-1.0.2.jar", - "sha256": "e4414d35013e746e5b06256a08dd957a814b17cebcb035899a84a3692d08b544" + "sha256": "e4414d35013e746e5b06256a08dd957a814b17cebcb035899a84a3692d08b544", + "project_id": 372534 }, { "project": "pams-harvestcraft-2-food-extended", - "id": "3190664", + "id": 3190664, "filename": "pamhc2foodextended-1.16.3-1.0.1.jar", - "sha256": "58a97f94f7087c2e66c9a6b2f33a328619bc544f46134597d3f612387b165668" + "sha256": "58a97f94f7087c2e66c9a6b2f33a328619bc544f46134597d3f612387b165668", + "project_id": 402231 }, { "project": "pams-harvestcraft-2-trees", - "id": "3117043", + "id": 3117043, "filename": "pamhc2trees-1.16.3-1.0.0.jar", - "sha256": "0b18c28cec6212d5256a9abaea13cbac502d329f70797d17a3523d8a662846ce" + "sha256": "0b18c28cec6212d5256a9abaea13cbac502d329f70797d17a3523d8a662846ce", + "project_id": 365460 }, { "project": "passable-foliage", - "id": "3103676", + "id": 3103676, "filename": "PassableFoliage-1.16.4-2.2.0.jar", - "sha256": "be727b1e5dc0412404af84145180b00222274c1f7d31f5bfed5bc716e6146eeb" + "sha256": "be727b1e5dc0412404af84145180b00222274c1f7d31f5bfed5bc716e6146eeb", + "project_id": 379887 }, { "project": "performant", - "id": "3285916", + "id": 3285916, "filename": "performant-1.16.2-5-3.54m.jar", - "sha256": "N8eUXJtIdbNRqZHLZ2gdj9HgpMYu7tAhMnG5Dw2dgqk=" + "sha256": "N8eUXJtIdbNRqZHLZ2gdj9HgpMYu7tAhMnG5Dw2dgqk=", + "project_id": 354143 }, { "project": "placebo", - "id": "3172794", + "id": 3172794, "filename": "Placebo-1.16.4-4.4.1.jar", - "sha256": "c57663a0b37260ca0cfaa6a4fb710d58f35866f029e92412b2332587a27d8f5d" + "sha256": "c57663a0b37260ca0cfaa6a4fb710d58f35866f029e92412b2332587a27d8f5d", + "project_id": 283644 }, { "project": "platter", - "id": "3115114", + "id": 3115114, "filename": "Platter-1.16-1.0.0.jar", - "sha256": "6e4aee987ac4efa41a1b9cc26a4e4588c79a56bb200402b9fee71e43ab45a533" + "sha256": "6e4aee987ac4efa41a1b9cc26a4e4588c79a56bb200402b9fee71e43ab45a533", + "project_id": 381581 }, { "project": "powah", - "id": "3209434", + "id": 3209434, "filename": "Powah-1.16.4-2.3.12.jar", - "sha256": "83806e56f79cb01382a6f105ffee8bba131afe52b04909138452eaffd0f87d49" + "sha256": "83806e56f79cb01382a6f105ffee8bba131afe52b04909138452eaffd0f87d49", + "project_id": 352656 }, { "project": "quark-oddities", - "id": "3088871", + "id": 3088871, "filename": "QuarkOddities-1.16.3.jar", - "sha256": "5eafd942f2eb9b13edde3bff451ee968c1d0fe549c8decd2f8551e59a079711d" + "sha256": "5eafd942f2eb9b13edde3bff451ee968c1d0fe549c8decd2f8551e59a079711d", + "project_id": 301051 }, { "project": "quark", - "id": "3208541", + "id": 3208541, "filename": "Quark-r2.4-305.jar", - "sha256": "02c6788bc39963b436de77e315808cd05ca09fddf8adeb27be5f5874cfd59b73" + "sha256": "02c6788bc39963b436de77e315808cd05ca09fddf8adeb27be5f5874cfd59b73", + "project_id": 243121 }, { "project": "refined-storage", - "id": "3196167", + "id": 3196167, "filename": "refinedstorage-1.9.12.jar", - "sha256": "dbe279c56a44decbbfcaf2b1d8aed84988a5ddb62b0c20ec8777e90ecb58e346" + "sha256": "dbe279c56a44decbbfcaf2b1d8aed84988a5ddb62b0c20ec8777e90ecb58e346", + "project_id": 243076 }, { "project": "repair-chests", - "id": "3111984", + "id": 3111984, "filename": "RepairChests-1.16.4-1.6.jar", - "sha256": "e93bfbadf085764e0f458ab7a77a6c1f7620039390ffa7f60f08914d09124468" + "sha256": "e93bfbadf085764e0f458ab7a77a6c1f7620039390ffa7f60f08914d09124468", + "project_id": 401644 }, { "project": "redstone-gauges-and-switches", - "id": "3179484", + "id": 3179484, "filename": "rsgauges-1.16.4-1.2.8.jar", - "sha256": "dcac66fb8d65080d5326310c173e215437e0fa15405721f494f6da27e125b785" + "sha256": "dcac66fb8d65080d5326310c173e215437e0fa15405721f494f6da27e125b785", + "project_id": 296686 }, { "project": "snow-real-magic", - "id": "3196605", + "id": 3196605, "filename": "SnowRealMagic-1.16.4-2.3.1.jar", - "sha256": "f588ae017f68f85dbdc26374282a0ad728ad44496577001314a2b2e5f22ef33b" + "sha256": "f588ae017f68f85dbdc26374282a0ad728ad44496577001314a2b2e5f22ef33b", + "project_id": 308663 }, { "project": "snow-under-trees", - "id": "3152350", + "id": 3152350, "filename": "snowundertrees-1.16.4-v1.1.3.jar", - "sha256": "6fb11fc0ff8542780796d481cc69549718dc6759b80bec43835003ebd33b8235" + "sha256": "6fb11fc0ff8542780796d481cc69549718dc6759b80bec43835003ebd33b8235", + "project_id": 353942 }, { "project": "spice-of-life-carrot-edition", - "id": "3174886", + "id": 3174886, "filename": "solcarrot-1.16.3-1.9.9.jar", - "sha256": "541ef38547ec17fb7cc485474747623d2dcc963a788c5ea300b39e31612e9022" + "sha256": "541ef38547ec17fb7cc485474747623d2dcc963a788c5ea300b39e31612e9022", + "project_id": 277616 }, { "project": "spark", - "id": "3245792", + "id": 3245792, "filename": "spark-forge.jar", - "sha256": "9BSMsIoiLWFFQje2jhnVqFNiFTXKITTAlIuDxUOgtds=" + "sha256": "9BSMsIoiLWFFQje2jhnVqFNiFTXKITTAlIuDxUOgtds=", + "project_id": 361579 }, { "project": "storage-drawers", - "id": "3180569", + "id": 3180569, "filename": "StorageDrawers-1.16.3-8.2.2.jar", - "sha256": "e8775a6bd6b4c61f2df6efe22294d41e390b1aef79d744233948cc1e2bb07651" + "sha256": "e8775a6bd6b4c61f2df6efe22294d41e390b1aef79d744233948cc1e2bb07651", + "project_id": 223852 }, { "project": "supplementaries", - "id": "3281805", + "id": 3281805, "filename": "supplementaries-1.16.5-0.12.1.jar", - "sha256": "sOjCHEhL1x/jF4D/HuYiKdXvFIZyPFeKk0ihY6SUqcI=" + "sha256": "sOjCHEhL1x/jF4D/HuYiKdXvFIZyPFeKk0ihY6SUqcI=", + "project_id": 412082 }, { "project": "sweet-concrete", - "id": "3186255", + "id": 3186255, "filename": "sweetconcrete-1.16.5-1.7.1.jar", - "sha256": "6333aeb7dbdf3d2c5365bc7679ef91d0eec1c6d1ac6ff2f86c19139abbb02afe" + "sha256": "6333aeb7dbdf3d2c5365bc7679ef91d0eec1c6d1ac6ff2f86c19139abbb02afe", + "project_id": 351052 }, { "project": "swingthroughgrass", - "id": "3103028", + "id": 3103028, "filename": "swingthroughgrass-1.16.4-1.5.3.jar", - "sha256": "d47132c8e97989f6f1b4c3c2c0736bf9e16e9a72970b3953fc80dcf8b1a4e31d" + "sha256": "d47132c8e97989f6f1b4c3c2c0736bf9e16e9a72970b3953fc80dcf8b1a4e31d", + "project_id": 264353 }, { "project": "the-bumblezone-forge", - "id": "3389654", + "id": 3389654, "filename": "the_bumblezone-1.16.5-2.4.9-forge.jar", - "sha256": "51b2b5860ee391df2ea76c235c6614b34225312ebadaca4893c8ff16b0e9242a" + "sha256": "51b2b5860ee391df2ea76c235c6614b34225312ebadaca4893c8ff16b0e9242a", + "project_id": 362479 }, { "project": "the-undergarden", - "id": "3361666", + "id": 3361666, "filename": "The_Undergarden-1.16.5-0.5.4.jar", - "sha256": "b596836a5c1d50cf1c65c50ea728b0e295965cf9a4091a8eb1caac517aad5c50" + "sha256": "b596836a5c1d50cf1c65c50ea728b0e295965cf9a4091a8eb1caac517aad5c50", + "project_id": 379849 }, { "project": "towers-of-the-wild", - "id": "3103750", + "id": 3103750, "filename": "towers_of_the_wild-1.16.4-2.0.1.jar", - "sha256": "fcd0e3f808569f0e547313a1ea3563c9a5d2fa8fbb638678eed6e46c1d8cfaf1" + "sha256": "fcd0e3f808569f0e547313a1ea3563c9a5d2fa8fbb638678eed6e46c1d8cfaf1", + "project_id": 386415 }, { "project": "travelers-backpack", - "id": "3171745", + "id": 3171745, "filename": "TravelersBackpack-1.16.4-5.3.8.jar", - "sha256": "cd15a1bef4388bfc492c96dab510d32fff17cd921a06393bbb7ab25f6f25fc88" + "sha256": "cd15a1bef4388bfc492c96dab510d32fff17cd921a06393bbb7ab25f6f25fc88", + "project_id": 321117 }, { "project": "the-weirding-gadget", - "id": "3116235", + "id": 3116235, "filename": "weirdinggadget-1.16.(2-4)-2.2.7.jar", - "sha256": "fe9b2d4f39020a4239a19ea0e7229beec29eb8f1ef2b2b198b9aa5aad0b13318" + "sha256": "fe9b2d4f39020a4239a19ea0e7229beec29eb8f1ef2b2b198b9aa5aad0b13318", + "project_id": 258914 }, { "project": "wither-skeleton-tweaks", - "id": "3172803", + "id": 3172803, "filename": "Wither-Skeleton-Tweaks-1.16.4-5.3.0.jar", - "sha256": "e6375312aeb188cda4951a4c4935343a64785303129dbb47f49f59768d0865d3" + "sha256": "e6375312aeb188cda4951a4c4935343a64785303129dbb47f49f59768d0865d3", + "project_id": 255902 }, { "project": "xaeros-minimap", - "id": "3200201", + "id": 3200201, "filename": "Xaeros_Minimap_21.3.0.2_Forge_1.16.5.jar", - "sha256": "d477b6838bc27bfc759dc8601582683fdc7d425736656d304a1cbae4d932c6f0" + "sha256": "d477b6838bc27bfc759dc8601582683fdc7d425736656d304a1cbae4d932c6f0", + "project_id": 263420 }, { "project": "xaeros-world-map", - "id": "3200214", + "id": 3200214, "filename": "XaerosWorldMap_1.12.0.2_Forge_1.16.5.jar", - "sha256": "d4cc27d1646ce8bb5411261b31f1a13b11b7ad709fe7d9be43c4c7c8caa529f1" + "sha256": "d4cc27d1646ce8bb5411261b31f1a13b11b7ad709fe7d9be43c4c7c8caa529f1", + "project_id": 317780 }, { "project": "yungs-api", - "id": "3186128", + "id": 3186128, "filename": "YungsApi-1.16.4-Forge-4.jar", - "sha256": "5a78eec5576ed162def18849bb604d5c69ec73b8715ab28ad41174ad0a673304" + "sha256": "5a78eec5576ed162def18849bb604d5c69ec73b8715ab28ad41174ad0a673304", + "project_id": 421850 } ] diff --git a/pkgs/minecraft/voor-kia/update-mods.py b/pkgs/minecraft/voor-kia/update-mods.py new file mode 100644 index 0000000..0af0b09 --- /dev/null +++ b/pkgs/minecraft/voor-kia/update-mods.py @@ -0,0 +1,151 @@ +import argparse +import json +import hashlib +from copy import deepcopy +from enum import Enum +from typing import Dict, Generator, NamedTuple, Optional, Union + +import requests + + +API = "https://addons-ecs.forgesvc.net/api/v2" + + +class ModLoader(Enum): + FORGE = 1 + FABRIC = 4 + + +class File(NamedTuple): + id: int + gameVersion: str + name: str + modLoader: Optional[ModLoader] + + @classmethod + def from_json(cls, f: Dict[str, Union[str, int]]): + modLoader = f.get("modLoader", None) + + assert isinstance(f["gameVersion"], str) + assert isinstance(f["projectFileId"], int) + assert isinstance(f["projectFileName"], str) + if modLoader is not None: + assert isinstance(modLoader, int) + + return cls( + f["projectFileId"], + f["gameVersion"], + f["projectFileName"], + ModLoader(modLoader) if modLoader is not None else None, + ) + + +class CurseAPI: + def __init__(self): + self._session = requests.Session() + self._session.headers[ + "User-Agent" + ] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0" + + def get_latest_files(self, mod_id: int) -> Generator[File, None, None]: + res = self._session.get(f"{API}/addon/{mod_id}") + res.raise_for_status() + + latest_files = res.json().get("gameVersionLatestFiles", None) + + if latest_files is None: + return (_ for _ in []) + else: + return (File.from_json(f) for f in latest_files) + + def get_file_url(self, mod_id: int, file_id: int) -> str: + res = self._session.get(f"{API}/addon/{mod_id}/file/{file_id}/download-url") + res.raise_for_status() + return res.text.rstrip("\n") + + def download_file(self, mod_id: int, file_id: int) -> bytes: + url = self.get_file_url(mod_id, file_id) + file_ = self._session.get(url) + file_.raise_for_status() + return file_.content + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("version", help="The minecraft version to limit updates to") + parser.add_argument( + "--mod-loader", choices=["none", "forge", "fabric"], default="forge" + ) + args = parser.parse_args() + + if args.mod_loader == "forge": + mod_loader = ModLoader.FORGE + elif args.mod_loader == "fabric": + mod_loader = ModLoader.FABRIC + else: + raise AssertionError("Unreachable") + + update(args.version, mod_loader) + + +def update(version: str, mod_loader: ModLoader): + with open("./mods.json") as mods_json: + mods = json.load(mods_json) + + curse = CurseAPI() + new_mods = [] + + for mod in mods: + print(f"Checking for updates to {mod['project']}...") + + try: + latest_files = list(curse.get_latest_files(mod["project_id"])) + except requests.HTTPError as err: + print(f"WARNING: Could not access curse API for {mod['project']}: {err}") + latest_files = [_ for _ in []] + + def compatible(file_: File) -> bool: + file_version = file_.gameVersion.split(".") + target_version = version.split(".") + + # We assume that major + minor version are compatible; + # this seems to generally be true, but check the output + # for possible mistakes. + # + # The patch version is completely ignored since mod + # authors generally don't register versions properly + # enough to match this. + # + # Being more strict than this usually results in + # technically compatible mods with no available versions. + return ( + (file_.modLoader is None or file_.modLoader == mod_loader) + and file_version[0] == target_version[0] + and file_version[1] == target_version[1] + ) + + latest = max(filter(compatible, latest_files), key=lambda f: f.gameVersion) + + if latest is None: + print(f"WARNING: No compatible files found for {mod['project']}") + print( + f"Versions available: {[(f.name, f.gameVersion) for f in latest_files]}" + ) + new_mods.append(mod) + elif latest.id != mod["id"]: + print(f"Updating {mod['project']}...") + contents = curse.download_file(mod["project_id"], latest.id) + sha256 = hashlib.sha256(contents).hexdigest() + + new_mod = deepcopy(mod) + new_mod.update({"filename": latest.name, "id": latest.id, "sha256": sha256}) + new_mods.append(new_mod) + else: + new_mods.append(mod) + + with open("temp.json", "w") as out: + json.dump(new_mods, out, sort_keys=True, indent=2) + + +if __name__ == "__main__": + main()