From e7747d48a2b9d5f172be9e7102c3ac5e9d22f9dd Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Fri, 12 Dec 2025 15:39:20 -0500 Subject: PROJECT 04 --- .gitignore | 4 +- PROJECT_04/config.txt | 29 ++++++++++ PROJECT_04/mods.txt | 75 ++++++++++++++++++++++++++ PROJECT_04/tree.txt | 40 ++++++++++++++ archive/patches/capes_custom.diff | 110 ++++++++++++++++++++++++++++++++++++++ scripts/check-tree.py | 11 ++-- website/requirements.txt | 2 +- website/run.sh | 2 +- website/site.py | 18 ++++--- website/static/index.html | 5 +- website/static/index.js | 34 ++++++++---- website/static/style.css | 9 ++++ website/static/template.html | 4 +- 13 files changed, 314 insertions(+), 29 deletions(-) create mode 100644 PROJECT_04/config.txt create mode 100644 PROJECT_04/mods.txt create mode 100644 PROJECT_04/tree.txt create mode 100644 archive/patches/capes_custom.diff diff --git a/.gitignore b/.gitignore index 99b7c90..4a4531b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -scripts/venv/ -website/venv/ +**/tree/ +**/venv/ diff --git a/PROJECT_04/config.txt b/PROJECT_04/config.txt new file mode 100644 index 0000000..52eebd0 --- /dev/null +++ b/PROJECT_04/config.txt @@ -0,0 +1,29 @@ += Configs + +[options.txt]c +[servers.dat]c + +[shaderpacks/BSL_v10.0.zip.txt]c +[shaderpacks/Mellow%20Shader%20v2.2.zip.txt]c + +[config/sodium-options.json]c + +[config/iris.properties]c + +[config/dynamic_fps.json]c +Invisible 0fps -> 1fps + +[config/capes.json5]c +Custom Cape IP + +[config/notenoughanimations.json]c +Disable Boat Rowing Animation +Disable Leg Smoothing + +[config/sounds/chat.json]c +Typing Pitch 1.6 -> 1.4 +[config/sounds/ui.json]c +[config/sounds/world.json]c +Disable unwanted + +// vim: set syntax=asciidoc: diff --git a/PROJECT_04/mods.txt b/PROJECT_04/mods.txt new file mode 100644 index 0000000..e99e4e6 --- /dev/null +++ b/PROJECT_04/mods.txt @@ -0,0 +1,75 @@ += 1.21.11 PROJECT_04 + +== Resourcepacks +- Motschen's Better Leaves [Better-Leaves-9.4.zip]r + * https://modrinth.com/resourcepack/better-leaves/version/9.4 +- Border Makeover (Style 3) [Border%20Makeover%20%28S3%29.zip]r + * https://modrinth.com/resourcepack/border-makeover/version/LQZHL56m + +== Shaders +- BSL Shaders [BSL_v10.0.zip]sh + * https://modrinth.com/shader/bsl-shaders/version/10.0 +- Mellow [Mellow%20Shader%20v2.2.zip]sh + * https://modrinth.com/shader/mellow/version/2.2 + +== Performance/Graphics +- Sodium [sodium-fabric-0.8.0%2Bmc1.21.11.jar]c + * https://modrinth.com/mod/sodium/version/mc1.21.11-0.8.0-fabric +- Iris [iris-fabric-1.10.2%2Bmc1.21.11.jar]c + * https://modrinth.com/mod/iris/version/1.10.2+1.21.11-fabric +- Entity Culling [entityculling-fabric-1.9.4-mc1.21.11.jar]c + * https://modrinth.com/mod/entityculling/version/P9ZiZM7Q +- ImmediatelyFast [ImmediatelyFast-Fabric-1.14.0%2B1.21.11.jar]c + * https://modrinth.com/mod/immediatelyfast/version/1.14.0+1.21.11-fabric +- Dynamic FPS [dynamic-fps-3.11.0%2Bminecraft-1.21.9-fabric.jar]c + * https://modrinth.com/mod/dynamic-fps/version/WfSXh637 +- Lithium [lithium-fabric-0.21.0%2Bmc1.21.11.jar]c,s + * https://modrinth.com/mod/lithium/version/mc1.21.11-0.21.0-fabric +- FerriteCore [ferritecore-8.0.3-fabric.jar]c,s + * https://modrinth.com/mod/ferrite-core/version/8.0.3-fabric + +== Visual +- Capes [capes-1.5.10+1.21.11-fabric.jar]c + * https://modrinth.com/mod/capes/version/1.5.10+1.21.11 +- Not Enough Animations [notenoughanimations-fabric-1.11.0-mc1.21.11.jar]c + * https://modrinth.com/mod/not-enough-animations/version/o0j7boKi + +== Audio +- Sounds [sounds-2.4.21%2Bedge%2B1.21.11-fabric.jar]c + * https://modrinth.com/mod/sound/version/2.4.21+edge+1.21.11-fabric +- Raise Sound Limit Simplified [rsls-1.1.13.jar]c + * https://modrinth.com/mod/rsls/version/1.1.13 +- x|Sound Physics Remastered [sound-physics-remastered-fabric-1.21.11-1.5.1.jar]c,s + * https://modrinth.com/mod/sound-physics-remastered/version/fabric-1.21.10-1.5.1 +- Simple Voice Chat [voicechat-fabric-1.21.11-2.6.7.jar]c,s + * https://modrinth.com/plugin/simple-voice-chat/version/fabric-1.21.11-2.6.7 + +== Utilities +- Mod Menu [modmenu-17.0.0-alpha.1.jar]c + * https://modrinth.com/mod/modmenu/version/17.0.0-alpha.1 +- WI Zoom [WI-Zoom-1.7-MC1.21.11.jar]c + * https://modrinth.com/mod/wi-zoom/version/1.7-MC1.21.11 + +== Chat +- Longer Chat History [LongerChatHistory-fabric-1.7.jar]c + * https://modrinth.com/mod/longer-chat-history/version/8ZILQQ32 +- Emoji Type [emoji-type-2.3.3-1.21.10-fabric.jar]c + * https://modrinth.com/mod/emoji-type/version/2.3.3-1.21.10-fabric +- Chat Heads [chat_heads-1.1.8-fabric-1.21.11.jar]c + * https://modrinth.com/mod/chat-heads/version/19GmaMFY +- Chat Animation [chatanimation-fabric-1.21.11-1.1.2.jar]c + * https://modrinth.com/mod/chatanimation/version/atsFATtj + +== Dependencies +- Fabric API [fabric-api-0.139.5%2B1.21.11.jar]c,s + * https://modrinth.com/mod/fabric-api/version/0.139.5+1.21.11 +- Fabric Language Kotlin [fabric-language-kotlin-1.13.7%2Bkotlin.2.2.21.jar]c + * https://modrinth.com/mod/fabric-language-kotlin/version/1.13.7+kotlin.2.2.21 +- M.R.U [mru-1.0.25%2Bedge%2B1.21.10-fabric.jar]c + * https://modrinth.com/mod/mru/version/1.0.25+edge+1.21.10-fabric + * Sounds +- YetAnotherConfigLib [yet_another_config_lib_v3-3.8.1%2B1.21.11-fabric.jar]c + * https://modrinth.com/mod/yacl/version/3.8.1+1.21.11-fabric + * Sounds + +// vim: set syntax=asciidoc: diff --git a/PROJECT_04/tree.txt b/PROJECT_04/tree.txt new file mode 100644 index 0000000..a07d708 --- /dev/null +++ b/PROJECT_04/tree.txt @@ -0,0 +1,40 @@ +tree/client-overrides/config/capes.json5 +tree/client-overrides/config/dynamic_fps.json +tree/client-overrides/config/iris.properties +tree/client-overrides/config/notenoughanimations.json +tree/client-overrides/config/sodium-options.json +tree/client-overrides/config/sounds/chat.json +tree/client-overrides/config/sounds/ui.json +tree/client-overrides/config/sounds/world.json +tree/client-overrides/mods/ImmediatelyFast-Fabric-1.14.0%2B1.21.11.jar +tree/client-overrides/mods/LongerChatHistory-fabric-1.7.jar +tree/client-overrides/mods/WI-Zoom-1.7-MC1.21.11.jar +tree/client-overrides/mods/capes-1.5.10+1.21.11-fabric.jar +tree/client-overrides/mods/chat_heads-1.1.8-fabric-1.21.11.jar +tree/client-overrides/mods/chatanimation-fabric-1.21.11-1.1.2.jar +tree/client-overrides/mods/dynamic-fps-3.11.0%2Bminecraft-1.21.9-fabric.jar +tree/client-overrides/mods/emoji-type-2.3.3-1.21.10-fabric.jar +tree/client-overrides/mods/entityculling-fabric-1.9.4-mc1.21.11.jar +tree/client-overrides/mods/fabric-language-kotlin-1.13.7%2Bkotlin.2.2.21.jar +tree/client-overrides/mods/iris-fabric-1.10.2%2Bmc1.21.11.jar +tree/client-overrides/mods/modmenu-17.0.0-alpha.1.jar +tree/client-overrides/mods/mru-1.0.25%2Bedge%2B1.21.10-fabric.jar +tree/client-overrides/mods/notenoughanimations-fabric-1.11.0-mc1.21.11.jar +tree/client-overrides/mods/rsls-1.1.13.jar +tree/client-overrides/mods/sodium-fabric-0.8.0%2Bmc1.21.11.jar +tree/client-overrides/mods/sounds-2.4.21%2Bedge%2B1.21.11-fabric.jar +tree/client-overrides/mods/yet_another_config_lib_v3-3.8.1%2B1.21.11-fabric.jar +tree/client-overrides/options.txt +tree/client-overrides/resourcepacks/Better-Leaves-9.4.zip +tree/client-overrides/resourcepacks/Border%20Makeover%20%28S3%29.zip +tree/client-overrides/servers.dat +tree/client-overrides/shaderpacks/BSL_v10.0.zip +tree/client-overrides/shaderpacks/BSL_v10.0.zip.txt +tree/client-overrides/shaderpacks/Mellow%20Shader%20v2.2.zip +tree/client-overrides/shaderpacks/Mellow%20Shader%20v2.2.zip.txt +tree/modrinth.index.json +tree/overrides/mods/fabric-api-0.139.5%2B1.21.11.jar +tree/overrides/mods/ferritecore-8.0.3-fabric.jar +tree/overrides/mods/lithium-fabric-0.21.0%2Bmc1.21.11.jar +tree/overrides/mods/sound-physics-remastered-fabric-1.21.11-1.5.1.jar.disabled +tree/overrides/mods/voicechat-fabric-1.21.11-2.6.7.jar diff --git a/archive/patches/capes_custom.diff b/archive/patches/capes_custom.diff new file mode 100644 index 0000000..3bcb9e4 --- /dev/null +++ b/archive/patches/capes_custom.diff @@ -0,0 +1,110 @@ +diff --git a/common/src/main/kotlin/me/cael/capes/CapeConfig.kt b/common/src/main/kotlin/me/cael/capes/CapeConfig.kt +index 4d3a40e..f7fcba4 100644 +--- a/common/src/main/kotlin/me/cael/capes/CapeConfig.kt ++++ b/common/src/main/kotlin/me/cael/capes/CapeConfig.kt +@@ -7,12 +7,14 @@ import java.io.PrintWriter + + class CapeConfig { + var clientCapeType = CapeType.MINECRAFT +- var enableOptifine = true ++ var enableOptifine = false + var enableLabyMod = false + var enableMinecraftCapesMod = false + var enableCosmetica = false + var enableCloaksPlus = false +- var enableElytraTexture = true ++ var enableElytraTexture = false ++ var customCapeUrl = ""; ++ var enableCustom = true + + fun save() { + val gson = GsonBuilder().setPrettyPrinting().create() +@@ -21,4 +23,4 @@ class CapeConfig { + PrintWriter(configFile).use { out -> out.println(json) } + } + +-} +\ No newline at end of file ++} +diff --git a/common/src/main/kotlin/me/cael/capes/CapeType.kt b/common/src/main/kotlin/me/cael/capes/CapeType.kt +index f61eb31..678f853 100644 +--- a/common/src/main/kotlin/me/cael/capes/CapeType.kt ++++ b/common/src/main/kotlin/me/cael/capes/CapeType.kt +@@ -5,7 +5,7 @@ import net.minecraft.screen.ScreenTexts + import net.minecraft.text.Text + + enum class CapeType(val stylized: String) { +- MINECRAFT("Minecraft"), OPTIFINE("OptiFine"), LABYMOD("LabyMod"), MINECRAFTCAPES("MinecraftCapes"), COSMETICA("Cosmetica"), CLOAKSPLUS("Cloaks+"); ++ MINECRAFT("Minecraft"), OPTIFINE("OptiFine"), LABYMOD("LabyMod"), MINECRAFTCAPES("MinecraftCapes"), COSMETICA("Cosmetica"), CLOAKSPLUS("Cloaks+"), CUSTOM("Custom"); + + fun cycle() = when(this) { + MINECRAFT -> OPTIFINE +@@ -13,7 +13,8 @@ enum class CapeType(val stylized: String) { + LABYMOD -> COSMETICA + COSMETICA -> MINECRAFTCAPES + MINECRAFTCAPES -> CLOAKSPLUS +- CLOAKSPLUS -> MINECRAFT ++ CLOAKSPLUS -> CUSTOM ++ CUSTOM -> MINECRAFT + } + + fun getURL(profile: GameProfile): String? { +@@ -24,6 +25,7 @@ enum class CapeType(val stylized: String) { + COSMETICA -> if(config.enableCosmetica) "https://api.cosmetica.cc/v2/get/info?uuid=${profile.id}" else null + MINECRAFTCAPES -> if(config.enableMinecraftCapesMod) "https://api.minecraftcapes.net/profile/${profile.id.toString().replace("-", "")}" else null + CLOAKSPLUS -> if(config.enableCloaksPlus) "http://161.35.130.99/capes/${profile.name}.png" else null ++ CUSTOM -> if(config.enableCustom) "http://${config.customCapeUrl}/static/capes/${profile.name}.png" else null + MINECRAFT -> null + } + } +diff --git a/common/src/main/kotlin/me/cael/capes/menu/ToggleMenu.kt b/common/src/main/kotlin/me/cael/capes/menu/ToggleMenu.kt +index 97c5323..25fb0ff 100644 +--- a/common/src/main/kotlin/me/cael/capes/menu/ToggleMenu.kt ++++ b/common/src/main/kotlin/me/cael/capes/menu/ToggleMenu.kt +@@ -4,6 +4,7 @@ import me.cael.capes.CapeType + import me.cael.capes.Capes + import net.minecraft.client.gui.screen.Screen + import net.minecraft.client.gui.widget.ButtonWidget ++import net.minecraft.client.gui.widget.TextFieldWidget + import net.minecraft.client.option.GameOptions + import net.minecraft.screen.ScreenTexts + import net.minecraft.text.Text +@@ -45,6 +46,19 @@ class ToggleMenu(parent: Screen, gameOptions: GameOptions) : MainMenu(parent, ga + it.message = CapeType.CLOAKSPLUS.getToggleText(config.enableCloaksPlus) + }.position(width / 2 - 155, height / 7 + 3 * 24).size(150, 20).build()) + ++ addDrawableChild(ButtonWidget.builder(CapeType.CUSTOM.getToggleText(config.enableCustom)) { ++ config.enableCustom = !config.enableCustom ++ config.save() ++ it.message = CapeType.CUSTOM.getToggleText(config.enableCustom) ++ }.position(width / 2 - 155 + 160, height / 7 + 3 * 24).size(150, 20).build()) ++ ++ val customUrlText = TextFieldWidget(textRenderer, width / 2 - 155 + 160, height / 7 + 4 * 24, 150, 20, Text.literal("Custom Cape URL")); ++ customUrlText.setText(config.customCapeUrl) ++ customUrlText.setChangedListener({ ++ config.customCapeUrl = it.toString() ++ }) ++ addDrawableChild(customUrlText) ++ + // addDrawableChild(ButtonWidget.builder(CapeType.CLOAKSPLUS.getToggleText(config.enableCloaksPlus)) { + // config.enableCloaksPlus = !config.enableCloaksPlus + // config.save() +@@ -55,14 +69,14 @@ class ToggleMenu(parent: Screen, gameOptions: GameOptions) : MainMenu(parent, ga + config.enableElytraTexture = !config.enableElytraTexture + config.save() + it.message = elytraMessage(config.enableElytraTexture) +- }.position((width/2) - (200 / 2), height / 7 + 4 * 24).size(200, 20).build()) ++ }.position((width/2) - (200 / 2), height / 7 + 5 * 24).size(200, 20).build()) + + addDrawableChild(ButtonWidget.builder(ScreenTexts.DONE) { + client!!.setScreen(parent) +- }.position((width/2) - (200 / 2), height / 7 + 5 * 24).size(200, 20).build()) ++ }.position((width/2) - (200 / 2), height / 7 + 6 * 24).size(200, 20).build()) + + } + + private fun elytraMessage(enabled: Boolean) = ScreenTexts.composeToggleText(Text.translatable("options.capes.elytra"), enabled) + +-} +\ No newline at end of file ++} diff --git a/scripts/check-tree.py b/scripts/check-tree.py index e37110a..8a4b010 100755 --- a/scripts/check-tree.py +++ b/scripts/check-tree.py @@ -60,8 +60,8 @@ with open(sys.argv[2], 'r', encoding='utf-8') as f: continue if listed_disabled and side not in ('r', 'd'): filename += '.disabled' - all_files.append(filename) target = f'{tree}/{mod_paths[side]}/{filename}' + all_files.append(target) if not os.path.isfile(target): print(f'err: Mod not found in the specified directory.\n\t{target}') any_error = True @@ -87,18 +87,19 @@ with open(sys.argv[3], 'r', encoding='utf-8') as f: side, path = parse_line(line, config_paths) if not side: continue - all_files.append(path.split('/')[-1]) target = f'{tree}/{config_paths[side]}/{path}' + all_files.append(target) if not os.path.isfile(target): print(f'err: Config file not found in specified directory.\n\t{target}') any_error = True for subdir, dirs, files in os.walk(tree): for file in files: - if not (subdir.endswith('mods') or subdir.endswith('resourcepacks') or subdir.endswith('datapacks')): + path = os.path.join(subdir, file) + if path == 'tree/modrinth.index.json': continue - if file not in all_files: - print(f'err: Erroneous file in tree.\n\t{os.path.join(subdir, file)}') + if path not in all_files: + print(f'err: Erroneous file in tree.\n\t{path}') any_error = True if not any_error: diff --git a/website/requirements.txt b/website/requirements.txt index e4045e2..73f4041 100644 --- a/website/requirements.txt +++ b/website/requirements.txt @@ -1 +1 @@ -web.py +web.py @ git+https://github.com/webpy/webpy@3e05bc6 diff --git a/website/run.sh b/website/run.sh index 851c47c..75d638e 100755 --- a/website/run.sh +++ b/website/run.sh @@ -1,4 +1,4 @@ #! /usr/bin/env sh export PYTHONDONTWRITEBYTECODE=1 export PYTHONOPTIMIZE=2 -python3 site.py +python3 site.py 12444 diff --git a/website/site.py b/website/site.py index 83b34e8..7e9603e 100644 --- a/website/site.py +++ b/website/site.py @@ -1,5 +1,6 @@ import re import web +import struct urls = ( '/capes', 'Capes', @@ -12,13 +13,18 @@ class Capes(): web.seeother('/static/index.html') def POST(self): - username = web.input().username + cape = web.input() + if type(cape.data) != bytes: + return web.notacceptable() + if not cape.data.startswith(bytes.fromhex('89504E470D0A1A0A')): + return web.notacceptable() + ihdr = struct.unpack('>IIBBBBB', cape.data[16:29]) + if ihdr[0] > 1024 or ihdr[1] > 1024: + return web.notacceptable() + username = cape.username username = re.sub(r'[^a-zA-Z0-9_]', '', username) with open(f'static/capes/{username}.png', 'wb+') as f: - if type(web.input().data) == bytes: - f.write(web.input().data) - else: - print('Unsupported type') + f.write(cape.data) -if __name__ == "__main__": +if __name__ == '__main__': app.run() diff --git a/website/static/index.html b/website/static/index.html index 6394fcf..73d5cb9 100644 --- a/website/static/index.html +++ b/website/static/index.html @@ -8,13 +8,14 @@
- + +

-
+
diff --git a/website/static/index.js b/website/static/index.js index 22bfc20..869eb0b 100644 --- a/website/static/index.js +++ b/website/static/index.js @@ -1,25 +1,39 @@ -const IP = "http://:12444"; +function onUsernameChanged(usernameInput) { + var preview = document.getElementById('preview'); + if (!usernameInput.value) { + preview.src = ''; + return false; + } + preview.src = '/static/capes/' + usernameInput.value + '.png?t=' + new Date().getTime(); + return true; +} function init() { - document.getElementById('file').addEventListener('change', handleFileSelect, false); + var filePicker = document.getElementById('file'); + filePicker.addEventListener('change', handleFileSelect, false); + var usernameInput = document.getElementById('username'); + filePicker.disabled = !onUsernameChanged(usernameInput); + usernameInput.addEventListener('input', (event) => { + filePicker.disabled = !onUsernameChanged(event.target); + }); } function handleFileSelect(event) { - var username = document.getElementById('username').value - if (!username) { - return; - } + var username = document.getElementById('username').value; + if (!username) return; const reader = new FileReader(); - const url = IP + '/capes'; var formData = new FormData(); formData.append('username', username); formData.append('data', event.target.files[0]); - fetch(url, { - method : "POST", + fetch('/capes', { + method : 'POST', body: formData }).then((response) => { if (response.ok) { - document.getElementById('preview').src = IP + '/static/capes/' + username + '.png'; + document.getElementById('preview').src = '/static/capes/' + username + '.png?t=' + new Date().getTime(); + document.getElementById('status').innerText = 'Upload success.'; + } else { + document.getElementById('status').innerText = 'Failed to upload cape. Image not a .png? or greater than 1024x1024?'; } }); } diff --git a/website/static/style.css b/website/static/style.css index 242ced7..0bab63f 100644 --- a/website/static/style.css +++ b/website/static/style.css @@ -14,6 +14,15 @@ image-rendering: pixelated; } +#status { + margin: inherit; + padding: 4px; +} + +#status:empty { + display: none; +} + #template { width: 100%; display: flex; diff --git a/website/static/template.html b/website/static/template.html index f7d62de..dade2f9 100644 --- a/website/static/template.html +++ b/website/static/template.html @@ -7,7 +7,7 @@
- +

    Top

    @@ -48,7 +48,7 @@
-

Right click and "Save Image As...", edit, then upload here.

+

Right click and "Save Image As...", edit, then upload here.

If you don't want to edit the Elytra texture, you can crop it out.

Feel free to scale. Only use integer scaling (Multiply width/height by a whole number).

-- cgit v1.2.3-101-g0448