Open RobertRR11 opened 1 year ago
tbh i've been wondering if this was possible, would be really nice to have. although, i dont wanna go all-in on requiring an internet connection for this app. ideally, this should be able to work offline, just like the original java version of the app, which is why ive started with a similar method of uploading files.
and yes i realize this probably doesn't make sense if you have to navigate to a website to use the app now LOL. but the entire app runs client-side, so in theory you could use it completely offline.
other than that, this could be very convenient for ppl who don't wanna go through the whole process of downloading and installing the entire mc client all over again just for textures and stuff x) def gonna look into this later
and yes i realize this probably doesn't make sense if you have to navigate to a website to use the app now LOL. but the entire app runs client-side, so in theory you could use it completely offline.
You could add a web app manifest. This makes the site downloadable and able to use offline
i know you could do smt like that for mobile devices, but does it work on desktop too?
I would need an icon with at least 144x144px in size (this one is just badly resized), but yes it is possible
Installing it creates a start menu entry and you can open it like a normal app. The title bar has some different display modes that can be modified from looking like a browser window to full app. The only examples I found were with mobile https://freefield.readthedocs.io/en/latest/_images/pwa-02-display-modes.png
that's fuckin awesome omg
could you do me a favor and put the PWA stuff into a separate issue? i'm 100% gonna pursue that too
back on the topic of the original post
i'm looking at the files you provided, but i can't seem to figure out if this allows you to download minecraft's hashed assets (sounds and stuff). it does let you get client and server jars, on top of a bunch of dependency jars like lwjgl, but i can't find anything else apart from the assetIndex
, which is just used to tell you where to find each file after they're already downloaded. is there another url for this anywhere?
After some digging I found a way to get the assets. In the assetIndex you mentioned, every asset has a hash:
29d4dccf3353334c7aa2a49cb6fed3780a51a1ba
as example hashwhich results to (scary cave sound) https://resources.download.minecraft.net/29/29d4dccf3353334c7aa2a49cb6fed3780a51a1ba
which results to (scary cave sound)
joking aside would u happen to know what the ratelimit might be for this? i imagine it's gonna be a lot of requests to get every individual asset over and over, and i'm not sure how feasible it would be to cache them (outside of a single session, anyway)
I know that the Mojang feedback API that uses Zendesk has a global limit of 700 per minute, but the piston meta and download APIs that use Azure look like they have no rate limit (could be read from the response header if they had). Also the launcher probably accesses that API too so it is unlikely there is a rate limit
shoutout to CORS for, as always, creating a massive roadblock for our projects.
mojang has not added the Access-Control-Allow-Origin
header to their resources endpoints, so the only way this would work is to have a custom backend to act as a CORS proxy. and since this app is hosted entirely through GitHub Pages, that's not really possible right now.
update: @RobertRR11 has found a free CORS proxy at https://allorigins.win/
so this might still be possible??
Mojang has an API for Minecraft assets that can be accessed publicly. This could probably be simplified to the point of the user just needing to select the version they want to extract. I'm not sure about extracting things like sounds but extracting textures using just client side JavaScript should be possible.
Some examples: Getting all versions: https://piston-meta.mojang.com/mc/game/version_manifest_v2.json
Getting data of the newest version (23w13a_or_b): above link > versions > 0 > url > https://piston-meta.mojang.com/v1/packages/f7dc73624306a835e2e7274b198260d361dc2005/23w13a_or_b.json
Getting the client jar of 23w13a_or_b: above link > downloads > client > url > https://piston-data.mojang.com/v1/objects/8ebf103ef3c48ff40d4d002f44c5f7bc5d90e7e2/client.jar
The file uploader could maybe also stay for things that aren't included in the default launcher like OptiFine, Fabric or Forge.