From 43eb52e2cb3ca864ae2dd461a067b65e0ded0fcb Mon Sep 17 00:00:00 2001 From: htmlcsjs <46023024+htmlcsjs@users.noreply.github.com> Date: Sun, 15 Oct 2023 19:20:57 +0100 Subject: [PATCH 1/8] Add a script to automatically update mods --- build/updateMods.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 build/updateMods.py diff --git a/build/updateMods.py b/build/updateMods.py new file mode 100644 index 00000000..eb1de466 --- /dev/null +++ b/build/updateMods.py @@ -0,0 +1,37 @@ +import os +import json +import requests +from datetime import datetime + +def is112(file): + True in ["1.12" in i for i in file["gameVersions"]] + +headers = { + "Accept": "application/json", + "x-api-key": os.getenv("CFAPIKEY") +} + +basePath = os.path.normpath(os.path.realpath(__file__)[:-13] + "..") +with open(f"{basePath}/manifest.json") as f: + manifest = json.load(f) + +ver_id = requests.get("https://api.curseforge.com/v1/minecraft/version/1.12.2", headers = headers).json()["data"]["gameVersionTypeId"] + +for entry in manifest["files"]: + project_id = entry["projectID"] + mod = requests.get(f"https://api.curseforge.com/v1/mods/{project_id}", headers = headers).json()["data"] + + old_file = requests.get(f"https://api.curseforge.com/v1/mods/{project_id}/files/" + str(entry["fileID"]), headers = headers).json()["data"] + + latest_files = requests.get(f"https://api.curseforge.com/v1/mods/{project_id}/files?gameVersionTypeId={ver_id}", headers = headers).json()["data"] + new_file = sorted(latest_files, key=lambda file: datetime.fromisoformat(file["fileDate"])) + + new_file = new_file[-1] + + if datetime.fromisoformat(new_file["fileDate"]) > datetime.fromisoformat(old_file["fileDate"]): + if input(mod["name"] + " (" + old_file["fileName"] + ") -> " + new_file["fileName"] + "?") == "y": + entry["fileID"] = new_file["id"] + + +with open(f"{basePath}/manifest.json", "w") as f: + json.dump(manifest, f) From a3b6c4e09ffa0e90276242a6b9ad083011a537ff Mon Sep 17 00:00:00 2001 From: htmlcsjs <46023024+htmlcsjs@users.noreply.github.com> Date: Sun, 15 Oct 2023 19:21:05 +0100 Subject: [PATCH 2/8] Update mods: - Xaero's Minimap: 23.8.0 -> 23.8.4 - Xaero's World Map: 1.34.1 -> 1.35.0 - censoredASM: 5.16 -> 5.17 - Mixinbooter: 8.4 -> 8.6 - CEu: 2.7.3 -> 2.7.4 - AE2 UEL: 0.55.23b -> 0.55.24 --- manifest.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/manifest.json b/manifest.json index c8b94c2b..7eb49d84 100644 --- a/manifest.json +++ b/manifest.json @@ -127,12 +127,12 @@ }, { "projectID": 263420, - "fileID": 4749534, + "fileID": 4799525, "required": true }, { "projectID": 317780, - "fileID": 4749555, + "fileID": 4799808, "required": true }, { @@ -265,7 +265,7 @@ }, { "projectID": 460609, - "fileID": 4769330, + "fileID": 4782047, "required": true }, { @@ -286,7 +286,7 @@ }, { "projectID": 419286, - "fileID": 4699275, + "fileID": 4752579, "required": true }, { @@ -337,7 +337,7 @@ }, { "projectID": 557242, - "fileID": 4701483, + "fileID": 4799055, "required": true }, { @@ -373,7 +373,7 @@ }, { "projectID": 570458, - "fileID": 4773115, + "fileID": 4796184, "required": true }, { @@ -428,4 +428,4 @@ "required": true } ] -} +} \ No newline at end of file From 8953b75b03bf25a9e6a407f9b1bab1e120ba0435 Mon Sep 17 00:00:00 2001 From: htmlcsjs <46023024+htmlcsjs@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:23:02 +0100 Subject: [PATCH 3/8] always add all ae2 recipes, and add a tooltip instead --- build/main.py | 128 +++++++++++++++++------------- groovy/assets/gcp/lang/en_us.lang | 3 +- groovy/postInit/ae2.groovy | 55 +++++-------- groovy/postInit/tooltips.groovy | 25 ++++++ 4 files changed, 123 insertions(+), 88 deletions(-) create mode 100644 groovy/postInit/tooltips.groovy diff --git a/build/main.py b/build/main.py index 96349967..adbe643c 100644 --- a/build/main.py +++ b/build/main.py @@ -16,31 +16,41 @@ def parse_args(): parser = argparse.ArgumentParser(prog="build", description=__doc__) - parser.add_argument("--sha", action="store_true", help="append git hash to zips") + parser.add_argument("--sha", action="store_true", + help="append git hash to zips") parser.add_argument("--name", type=str, help="append name to zips") - parser.add_argument("--retries", type=int, default=3, help="download attempts before failure") - parser.add_argument("--clean", action="store_true", help="clean output dirs") + parser.add_argument("--retries", type=int, default=3, + help="download attempts before failure") + parser.add_argument("--clean", action="store_true", + help="clean output dirs") parser.add_argument("--dev_build", action="store_true", help="makes a folder with all the files symlinked for development. probally only works on linux") + parser.add_argument("-c", "--client", action="store_true", + help="only builds the client pack") return parser.parse_args() def build(args): modlist = [] basePath = os.path.normpath(os.path.realpath(__file__)[:-7] + "..") - copyDirs = ["/groovy", "/config", "/mods", "/structures"] - serverCopyDirs = ["/groovy", "/config", "/mods", "/structures"] + copyDirs = ["/config", "/mods", "/groovy"] + serverCopyDirs = ["/config", "/mods", "/groovy"] modURLlist = [] modClientOnly = [] + # remove the old build files + + shutil.rmtree(basePath + "/buildOut/client/overrides", + ignore_errors=True) + shutil.rmtree(basePath + "/buildOut/server", ignore_errors=True) + if args.clean: - shutil.rmtree(basePath + "/buildOut/client/overrides", ignore_errors=True) - shutil.rmtree(basePath + "/buildOut/server", ignore_errors=True) shutil.rmtree(basePath + "/mods", ignore_errors=True) sys.exit(0) sha = "" if args.sha: try: - p = subprocess.run(["git", "rev-parse", "--short", "HEAD"], capture_output=True, cwd=basePath) + p = subprocess.run( + ["git", "rev-parse", "--short", "HEAD"], capture_output=True, cwd=basePath) sha = p.stdout.strip().decode("utf-8") except Exception as e: print("could not determine git sha, skipping") @@ -78,54 +88,58 @@ def mkdirs(path): r = requests.get(mod["url"]) - hash = hashlib.sha256(jar.read()).hexdigest() + hash = hashlib.sha256(r.content).hexdigest() if str(hash) == mod["hash"]: jar.write(r.content) modlist.append(mod["name"]) - print("hash succsessful") + print("hash succsessful for {}".format(mod["name"])) break else: - print("hash unsuccsessful") + print("hash unsuccsessful for {}".format(mod["name"])) print("use", str(hash), "this if it is consistant across runs") pass + for dir in copyDirs: try: - shutil.copytree(basePath + dir, basePath + "/buildOut/client/overrides" + dir) + shutil.copytree(basePath + dir, basePath + + "/buildOut/client/overrides" + dir) except Exception as e: print("Directory exists, skipping") + print("directories copied to buildOut/client") archive = "buildOut/client" if sha: archive = "%s-%s" % (archive, sha) - shutil.copy(basePath + "/manifest.json", basePath + "/buildOut/client/manifest.json") + shutil.copy(basePath + "/manifest.json", basePath + + "/buildOut/client/manifest.json") shutil.make_archive(archive, "zip", basePath + "/buildOut/client") print('client zip "%s.zip" made' % (archive)) + + if (args.client): + return + cringe = [] - headers = {'Accept': 'application/json', 'x-api-key': os.getenv("CFAPIKEY")} + headers = {'Accept': 'application/json', + 'x-api-key': os.getenv("CFAPIKEY")} for mod in manifest["files"]: - clientOnly = False - try: - clientOnly = mod["clientOnly"] - # clean up the distributed file - del mod["clientOnly"] - except: - pass - modClientOnly.append(clientOnly) - r = requests.get( - 'https://api.curseforge.com/v1/mods/{0}/files/{1}/download-url'.format(mod["projectID"], mod["fileID"]), + 'https://api.curseforge.com/v1/mods/{0}/files/{1}/download-url'.format( + mod["projectID"], mod["fileID"]), headers=headers) try: metadata = json.loads(r.text) except: print( 'https://api.curseforge.com/v1/mods/{0}/files/{1}/download-url'.format(mod["projectID"], mod["fileID"])) - cringe_r = requests.get('https://api.curseforge.com/v1/mods/{0}'.format(mod["projectID"]), headers=headers) + cringe_r = requests.get( + 'https://api.curseforge.com/v1/mods/{0}'.format(mod["projectID"]), headers=headers) try: data = cringe_r.json()["data"] - cringe.append("https://www.curseforge.com/minecraft/mc-mods/{0}/files/{1}".format(data["slug"], mod["fileID"])) + cringe.append( + "https://www.curseforge.com/minecraft/mc-mods/{0}/files/{1}".format(data["slug"], mod["fileID"])) except: - cringe.append('This is the raw mod id and file id, the cf api was being mega fucked: `{0}`, `{1}`'.format(mod["projectID"], mod["fileID"])) + cringe.append('This is the raw mod id and file id, the cf api was being odd: `{0}`, `{1}`'.format( + mod["projectID"], mod["fileID"])) continue @@ -136,14 +150,12 @@ def mkdirs(path): modlist.append(name) else: modlist.append(metadata["data"].split("/")[-1]) - modURLlist.append(metadata["data"]) - - # write the json without "clientOnly" to the file - with open(basePath + "/manifest.json", mode='w') as file: - json.dump(manifest, file, indent=4); - + modURLlist.append(metadata["data"]) + try: + modClientOnly.append(mod["clientOnly"]) + except: + modClientOnly.append(False) print("modlist compiled") - with open(basePath + "/buildOut/modlist.html", "w") as file: data = "

Modlist

" file.write(data) print("modlist.html done") - shutil.copy(basePath + "/manifest.json", basePath + "/buildOut/server/manifest.json") + shutil.copy(basePath + "/manifest.json", basePath + + "/buildOut/server/manifest.json") shutil.copy(basePath + "/LICENSE", basePath + "/buildOut/server/LICENSE") - shutil.copy(basePath + "/launch.sh", basePath + "/buildOut/server/launch.sh") + shutil.copy(basePath + "/launch.sh", basePath + + "/buildOut/server/launch.sh") for dir in serverCopyDirs: try: - shutil.copytree(basePath + dir, basePath + "/buildOut/server" + dir) + shutil.copytree(basePath + dir, basePath + + "/buildOut/server" + dir) except Exception as e: print("Directory exists, skipping") print("directories copied to buildOut/server") for i, mod in enumerate(modURLlist): jarname = mod.split("/")[-1] - if (modClientOnly[i]): - continue + if (modClientOnly[i] == True): + break if os.path.exists(os.path.join(cachepath, jarname)): shutil.copy2(os.path.join(cachepath, jarname), @@ -180,15 +195,15 @@ def mkdirs(path): forgeVer = manifest["minecraft"]["modLoaders"][0]["id"].split("-")[-1] mcVer = manifest["minecraft"]["version"] url = ( - "https://maven.minecraftforge.net/net/minecraftforge/forge/" - + mcVer - + "-" - + forgeVer - + "/forge-" - + mcVer - + "-" - + forgeVer - + "-installer.jar" + "https://maven.minecraftforge.net/net/minecraftforge/forge/" + + mcVer + + "-" + + forgeVer + + "/forge-" + + mcVer + + "-" + + forgeVer + + "-installer.jar" ) r = requests.get(url) jar.write(r.content) @@ -201,7 +216,8 @@ def mkdirs(path): r = requests.get(url) jar.write(r.content) print("Vanilla Downloaded") - subprocess.run(["java", "-jar", "forge-installer.jar", "--installServer"], cwd=basePath + "/buildOut/server/") + subprocess.run(["java", "-jar", "forge-installer.jar", + "--installServer"], cwd=basePath + "/buildOut/server/") print("Forge Installed") if len(cringe) != 0 or os.path.exists(basePath + "/README_SERVER.md"): with open(basePath + "/buildOut/server/README_SERVER.md", "w") as f: @@ -232,17 +248,19 @@ def mkdirs(path): shutil.rmtree(basePath + "/buildOut/mmc/minecraft/mods/") except: pass - shutil.copytree(basePath + "/buildOut/server/mods/", basePath + "/buildOut/mmc/minecraft/mods/") + shutil.copytree(basePath + "/buildOut/server/mods/", + basePath + "/buildOut/mmc/minecraft/mods/") for dir in copyDirs: try: - os.symlink(basePath + dir, basePath + "/buildOut/mmc/minecraft/" + dir) + os.symlink(basePath + dir, basePath + + "/buildOut/mmc/minecraft/" + dir) except Exception as e: print("Directory exists, skipping") print("directories copied to buildOut/mmc/minecraft") for i, mod in enumerate(modURLlist): jarname = mod.split("/")[-1] - if (not modClientOnly[i]): + if (modClientOnly[i] == False): break with open(basePath + "/buildOut/mmc/minecraft/mods/" + jarname, "w+b") as jar: @@ -250,10 +268,12 @@ def mkdirs(path): jar.write(r.content) print(mod + " Downloaded") - shutil.copy(basePath + "/mmc-instance-data.json", basePath + "/buildOut/mmc/mmc-pack.json") + shutil.copy(basePath + "/mmc-instance-data.json", + basePath + "/buildOut/mmc/mmc-pack.json") instanceFolder = input("What is your MultiMC instance folder:") instanceName = input("What do you want to call the instance:") - os.symlink(basePath + "/buildOut/mmc/", instanceFolder + "/" + instanceName) + os.symlink(basePath + "/buildOut/mmc/", + instanceFolder + "/" + instanceName) print("you might need to add an instance.cfg for mmc to reconise it") print("done") diff --git a/groovy/assets/gcp/lang/en_us.lang b/groovy/assets/gcp/lang/en_us.lang index 4c240238..986c1bfa 100644 --- a/groovy/assets/gcp/lang/en_us.lang +++ b/groovy/assets/gcp/lang/en_us.lang @@ -1,4 +1,3 @@ - # Recipemaps recipemap.greenhouse.name=Greenhouse @@ -6,3 +5,5 @@ recipemap.greenhouse.name=Greenhouse gcp.machine.greenhouse.name=Greenhouse gcp.machine.greenhouse.tooltip=Plant Growth Simulator +# tooltips +gcp.ae2.channels.disabled=§7Channels are disabled§r diff --git a/groovy/postInit/ae2.groovy b/groovy/postInit/ae2.groovy index a11d5c9e..e4774144 100644 --- a/groovy/postInit/ae2.groovy +++ b/groovy/postInit/ae2.groovy @@ -1,5 +1,3 @@ -import appeng.core.AEConfig; -import appeng.core.features.AEFeature import gregtech.api.recipes.ingredients.nbtmatch.NBTCondition import gregtech.api.recipes.ingredients.nbtmatch.NBTMatcher import classes.globals @@ -1234,8 +1232,7 @@ crafting.shapedBuilder().name('network_portable_cell') .key('W', ore('cableGtSingleRedAlloy')) .register() -def final hasChannels = AEConfig.instance().isFeatureEnabled(AEFeature.CHANNELS) -def final range = hasChannels ? [0, 20, 40, 60, 500] : [0, 20] +def final range = [0, 20, 40, 60, 500] // AE Cables for (int i = 0; i < globals.DYES.size(); i++) { @@ -1303,41 +1300,33 @@ crafting.shapelessBuilder().name('deconstruction_fluix_block') // Channels Items // ME Controller -if (hasChannels) { - crafting.shapedBuilder().name('me_controller') - .output(item('appliedenergistics2:controller')) - .matrix('PPP', 'FCF', 'PPP') - .key('P', ore('plateAluminium')) - .key('F', item('appliedenergistics2:part', 16)) - .key('C', ore('circuitMv')) - .register() -} +crafting.shapedBuilder().name('me_controller') + .output(item('appliedenergistics2:controller')) + .matrix('PPP', 'FCF', 'PPP') + .key('P', ore('plateAluminium')) + .key('F', item('appliedenergistics2:part', 16)) + .key('C', ore('circuitMv')) + .register() // Smart Cable crafting.remove('appliedenergistics2:network/cables/smart_fluix') -if (hasChannels) { - recipemap('assembler').recipeBuilder() - .inputs(item('appliedenergistics2:part', 36) * 8) - .inputs(ore('circuitLv')) - .outputs(item('appliedenergistics2:part', 56) * 8) - .duration(200).EUt(8).buildAndRegister() -} +recipemap('assembler').recipeBuilder() + .inputs(item('appliedenergistics2:part', 36) * 8) + .inputs(ore('circuitLv')) + .outputs(item('appliedenergistics2:part', 56) * 8) + .duration(200).EUt(8).buildAndRegister() // Dense Cable crafting.remove('appliedenergistics2:network/cables/dense_covered_fluix') -if (hasChannels) { - recipemap('compressor').recipeBuilder() - .inputs(item('appliedenergistics2:part', 36) * 4) - .outputs(item('appliedenergistics2:part', 516)) - .duration(400).EUt(2).buildAndRegister() -} +recipemap('compressor').recipeBuilder() + .inputs(item('appliedenergistics2:part', 36) * 4) + .outputs(item('appliedenergistics2:part', 516)) + .duration(400).EUt(2).buildAndRegister() // Dense Smart Cable crafting.remove('appliedenergistics2:network/cables/dense_smart_fluix') -if (hasChannels) { - recipemap('assembler').recipeBuilder() - .inputs(item('appliedenergistics2:part', 516) * 8) - .inputs(ore('circuitMv')) - .outputs(item('appliedenergistics2:part', 76) * 8) - .duration(200).EUt(8).buildAndRegister() -} +recipemap('assembler').recipeBuilder() + .inputs(item('appliedenergistics2:part', 516) * 8) + .inputs(ore('circuitMv')) + .outputs(item('appliedenergistics2:part', 76) * 8) + .duration(200).EUt(8).buildAndRegister() diff --git a/groovy/postInit/tooltips.groovy b/groovy/postInit/tooltips.groovy new file mode 100644 index 00000000..d6f8d492 --- /dev/null +++ b/groovy/postInit/tooltips.groovy @@ -0,0 +1,25 @@ +// SIDE: CLIENT +import appeng.core.AEConfig; +import appeng.core.features.AEFeature; +import classes.globals; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; + +def channels_list = [item("appliedenergistics2:controller"), item("appliedenergistics2:part", 56), item("appliedenergistics2:part", 516), item("appliedenergistics2:part", 76)] + +for (int i = 0; i < globals.DYES.size(); i++) { + for (offset in [0, 20, 40, 60, 500]) { + channels_list.add(item("appliedenergistics2:part", offset + i)) + } +} + +event_manager.listen { ItemTooltipEvent event -> + def final hasChannels = AEConfig.instance().isFeatureEnabled(AEFeature.CHANNELS) + if (!hasChannels) { + for (item in channels_list) { + if (event.getItemStack().isItemEqual(item)) { + event.getToolTip().add(net.minecraft.client.resources.I18n.format("gcp.ae2.channels.disabled")) + } + } + } +} + From 182a20196f33ec6440bc34e96dcf7286d64fb150 Mon Sep 17 00:00:00 2001 From: htmlcsjs <46023024+htmlcsjs@users.noreply.github.com> Date: Wed, 29 Nov 2023 15:19:44 +0000 Subject: [PATCH 4/8] Update mods: - GregTech CE Unofficial 2.7.4-beta -> 2.8.1-beta - GroovyScript 0.6.4 -> 0.7.0 - VisualOres 0.2.2 -> 0.2.4 - Had Enough Items 4.25.0 -> 4.25.1 - Xaero's Minimap 23.8.3 -> 23.9.0 - Xaero's World Map 1.35.0 -> 1.37.0 - CensoredASM 5.17 -> 5.18 - MixinBooter 8.6 -> 8.9 - LittleTiles v1.5.82 -> v1.5.84 - AE2 Unofficial Extended Life v0.55.24 -> v0.55.27 - AE2 Fluid Crafting Rework 2.4.31-r -> 2.4.33-r - Sledgehammer 2.0.23 -> 2.0.25 --- manifest.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/manifest.json b/manifest.json index 7eb49d84..9b38ad36 100644 --- a/manifest.json +++ b/manifest.json @@ -18,7 +18,7 @@ "files": [ { "projectID": 557549, - "fileID": 4571247, + "fileID": 4810661, "required": true }, { @@ -127,12 +127,12 @@ }, { "projectID": 263420, - "fileID": 4799525, + "fileID": 4905586, "required": true }, { "projectID": 317780, - "fileID": 4799808, + "fileID": 4905614, "required": true }, { @@ -265,7 +265,7 @@ }, { "projectID": 460609, - "fileID": 4782047, + "fileID": 4800875, "required": true }, { @@ -286,7 +286,7 @@ }, { "projectID": 419286, - "fileID": 4752579, + "fileID": 4835295, "required": true }, { @@ -296,7 +296,7 @@ }, { "projectID": 257818, - "fileID": 4750222, + "fileID": 4884120, "required": true }, { @@ -337,7 +337,7 @@ }, { "projectID": 557242, - "fileID": 4799055, + "fileID": 4910613, "required": true }, { @@ -373,7 +373,7 @@ }, { "projectID": 570458, - "fileID": 4796184, + "fileID": 4851091, "required": true }, { @@ -393,12 +393,12 @@ }, { "projectID": 623955, - "fileID": 4733637, + "fileID": 4845148, "required": true }, { "projectID": 319175, - "fileID": 4501755, + "fileID": 4810564, "required": true }, { @@ -414,7 +414,7 @@ }, { "projectID": 687577, - "fileID": 4749823, + "fileID": 4905039, "required": true }, { @@ -424,7 +424,7 @@ }, { "projectID": 895539, - "fileID": 4729414, + "fileID": 4904325, "required": true } ] From 3735e18c7a85b99fb5647c6e84e87bad2f6e8c27 Mon Sep 17 00:00:00 2001 From: htmlcsjs <46023024+htmlcsjs@users.noreply.github.com> Date: Wed, 29 Nov 2023 16:14:29 +0000 Subject: [PATCH 5/8] downgrade Xaero's mods due to instability - Xaero's Minimap 23.9.0 -> 23.8.4 - Xaero's World Map 1.37.0 -> 1.36.0 --- build/main.py | 7 +++---- build/updateMods.py | 2 +- manifest.json | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/build/main.py b/build/main.py index adbe643c..8486b887 100644 --- a/build/main.py +++ b/build/main.py @@ -155,6 +155,7 @@ def mkdirs(path): modClientOnly.append(mod["clientOnly"]) except: modClientOnly.append(False) + print("modlist compiled") with open(basePath + "/buildOut/modlist.html", "w") as file: data = "

Modlist