From 6ff73fb0f87213bbc65c5cbec35b1b95b4bf9785 Mon Sep 17 00:00:00 2001 From: htmlcsjs <46023024+htmlcsjs@users.noreply.github.com> Date: Tue, 12 Dec 2023 06:46:30 +0000 Subject: [PATCH] Prepare Update (#112) * Add a script to automatically update mods * 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 * always add all ae2 recipes, and add a tooltip instead * 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 * 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 * move gt cfg to new location * revert ae2 script changes * mod updates xaero's minimap -> v23.9.1 xaero's worldmap -> v1.37.1 mixinbooter -> v8.8 littletiles -> v1.5.85 gtceu -> v2.8.3 sledgehammer -> v2.0.25 groovyscript -> v0.7.1 removes MTLib --------- Co-authored-by: TechLord22 <37029404+techlord22@users.noreply.github.com> --- build/main.py | 127 +++++++++++++++++------------ build/updateMods.py | 37 +++++++++ config/{ => gregtech}/gregtech.cfg | 56 ++++++++++++- manifest.json | 31 +++---- 4 files changed, 175 insertions(+), 76 deletions(-) create mode 100644 build/updateMods.py rename config/{ => gregtech}/gregtech.cfg (93%) mode change 100755 => 100644 diff --git a/build/main.py b/build/main.py index 96349967..8486b887 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,13 @@ 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]): + if (modClientOnly[i] == True): continue if os.path.exists(os.path.join(cachepath, jarname)): @@ -180,15 +196,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 +217,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,28 +249,30 @@ 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.copytree(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]): - break with open(basePath + "/buildOut/mmc/minecraft/mods/" + jarname, "w+b") as jar: r = requests.get(mod) 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/build/updateMods.py b/build/updateMods.py new file mode 100644 index 00000000..e04d4e81 --- /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, indent=4) diff --git a/config/gregtech.cfg b/config/gregtech/gregtech.cfg old mode 100755 new mode 100644 similarity index 93% rename from config/gregtech.cfg rename to config/gregtech/gregtech.cfg index 2c263f39..d96dbc4b --- a/config/gregtech.cfg +++ b/config/gregtech/gregtech.cfg @@ -9,7 +9,7 @@ general { ########################################################################################################## "client options" { - # Whether or not to enable Emissive Textures for GregTech Casings when the multiblock is working (EBF coils, Fusion Casings, etc.). + # Whether or not to enable Emissive Textures for Electric Blast Furnace Coils when the multiblock is working. # Default: false B:coilsActiveEmissiveTextures=true @@ -55,6 +55,10 @@ general { # Max: 16777215 I:multiblockPreviewFontColor=3355443 + # Prevent optical and laser cables from animating when active. + # Default: false + B:preventAnimatedCables=false + # Prevent tooltips from blinking for better visibility B:preventBlinkingTooltips=false @@ -77,12 +81,21 @@ general { # Default: true B:toolUseSounds=true + # Whether to use the Spray Can color in UIs when a machine is painted. + # Default: true + B:useSprayCanColorInUI=true + "gui config" { # The scrolling speed of widgets # Default: 13 # Min: 1 # Max: 2147483647 I:scrollSpeed=13 + + # If progress bars should move smoothly. + # False is incremental like the Minecraft furnace. + # Default: true + B:smoothProgressBars=true } "armor hud location" { @@ -321,7 +334,7 @@ general { ########################################################################################################## # energy compat options #--------------------------------------------------------------------------------------------------------# - # Config options regarding GTEU compatibility with other energy systems + # Config options regarding GTEU compatibility with AE2 ########################################################################################################## "energy compat options" { @@ -343,10 +356,23 @@ general { # Max: 16 I:feToEuRatio=4 + # The energy consumption of ME Hatch/Bus. + # Default: 1.0AE/t + # Min: 0.0 + # Max: 10.0 + D:meHatchEnergyUsage=1.0 + # Enable Native GTEU to Forge Energy (RF and alike) on GT Cables and Wires. # This does not enable nor disable Converters. # Default: true B:nativeEUToFE=true + + # The interval between ME Hatch/Bus interact ME network. + # It may cause lag if the interval is too small. + # Default: 2 sec + # Min: 1 + # Max: 80 + I:updateIntervals=40 } } @@ -419,6 +445,14 @@ general { # Default: false B:highTierContent=false + # Minimum distance betweeb Long Distance Fluid Pipe Endpoints + # Default: 50 + I:ldFluidPipeMinDistance=50 + + # Minimum distance between Long Distance Item Pipe Endpoints + # Default: 50 + I:ldItemPipeMinDistance=50 + # Whether to play machine sounds while machines are active. # Default: true B:machineSounds=true @@ -503,6 +537,10 @@ general { # Whether to give the terminal to new players on login # Default: true B:spawnTerminal=true + + # Whether to enable Special Event features (e.g. Christmas, etc). + # Default: true + B:specialEvents=true } ########################################################################################################## @@ -512,6 +550,12 @@ general { ########################################################################################################## "recipe options" { + # How many Multiblock Casings to make per craft. Either 1, 2, or 3. + # Default: 2 + # Min: 1 + # Max: 3 + I:casingsPerCraft=2 + # Whether to disable the Vanilla Concrete from Powder with Water behavior, forcing the GT recipe. # Default: false B:disableConcreteInWorld=false @@ -562,7 +606,7 @@ general { # Default: false B:hardWoodRecipes=false - # Whether to make crafting recipes for Bricks, Firebricks, and Coke Bricks harder. + # Whether to make crafting recipes for Bricks, Nether Bricks, Firebricks, and Coke Bricks harder. # Default: false B:harderBrickRecipes=false @@ -570,6 +614,10 @@ general { # Default: true B:harderCharcoalRecipe=true + # Whether to nerf the output amounts of the first circuit in a set to 1 (from 2) and SoC to 2 (from 4). + # Default: false + B:harderCircuitRecipes=false + # Whether to make the recipe for the EBF Controller harder. # Default: false B:harderEBFControllerRecipe=false @@ -724,7 +772,7 @@ general { # Whether to increase number of rolls for dungeon chests. Increases dungeon loot drastically. # Default: true - B:increaseDungeonLoot=false + B:increaseDungeonLoot=true # Specifies the minimum number of veins in a section. # Default: 1 diff --git a/manifest.json b/manifest.json index c8b94c2b..3fe05426 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": 4749534, + "fileID": 4911777, "required": true }, { "projectID": 317780, - "fileID": 4749555, + "fileID": 4911823, "required": true }, { @@ -178,11 +178,6 @@ "fileID": 3045651, "required": true }, - { - "projectID": 253211, - "fileID": 3308160, - "required": true - }, { "clientOnly": true, "projectID": 314002, @@ -265,7 +260,7 @@ }, { "projectID": 460609, - "fileID": 4769330, + "fileID": 4800875, "required": true }, { @@ -286,7 +281,7 @@ }, { "projectID": 419286, - "fileID": 4699275, + "fileID": 4828995, "required": true }, { @@ -296,7 +291,7 @@ }, { "projectID": 257818, - "fileID": 4750222, + "fileID": 4916630, "required": true }, { @@ -337,7 +332,7 @@ }, { "projectID": 557242, - "fileID": 4701483, + "fileID": 4951281, "required": true }, { @@ -373,7 +368,7 @@ }, { "projectID": 570458, - "fileID": 4773115, + "fileID": 4851091, "required": true }, { @@ -393,12 +388,12 @@ }, { "projectID": 623955, - "fileID": 4733637, + "fileID": 4845148, "required": true }, { "projectID": 319175, - "fileID": 4501755, + "fileID": 4810570, "required": true }, { @@ -414,7 +409,7 @@ }, { "projectID": 687577, - "fileID": 4749823, + "fileID": 4941103, "required": true }, { @@ -424,8 +419,8 @@ }, { "projectID": 895539, - "fileID": 4729414, + "fileID": 4904325, "required": true } ] -} +} \ No newline at end of file