OASIS-learn-study / minecraft-storeys-maker

Minecraft extension to make your own stories in, with and for Minecraft - it's like being a movie director!
https://www.learn.study
GNU Affero General Public License v3.0
14 stars 10 forks source link

Minecraft server should be able to load JS & Java (JAR) from a server URL running e.g. in a GitHub Codespace #380

Open vorburger opened 2 years ago

vorburger commented 2 years ago

It would be super cool if the Minecraft server had a slash command to which one could give a URL which from which it would (continously, re-)load both JS as well as Java (JAR) using a HTTP client. You could then code JS & Java e.g. in a GitHub Codespace with a HTTP server exposing it... 😸

To avoid having to do regular polling, using HTTP chunked transfer encoding could be used. Ratpack seems to make it (relatively, it's still some work...) easy to write such a server, see ResponseChunks. It also comes with nice Gradle support. It may be simplest to have this server be a part of the example/ project instead of a library, because this would make it easy to later factor out the example into a separate GitHub repo which kids users can fork.

Vert.x has support for HTTP chunked transfer encoding as well, but as this HTTP server would be running on the "client", outside of the Minecraft server, I think there is really no good reason for us using our existing Vert.x server integration of instead Ratpack; especially given Ratpack's Gradle integration?

JS projects could likely easily similarly expose the built JS, maybe generated from a TS, on some Node server with HTTP chunked transfer encoding.

Java projects would require both #379 as well as #378 as pre-requisites for this.

The HTTP client should be a small new module which continously download a (?) file(s?) from a HTTP URL serving such chunks and saves them to the filesystem. This module would be used in the example/ to integration test its web server, and then embedded in the Minecraft server. We cannot use JDK's HTTP client with chunks support, because that's Java 11 only (whereas we're still on Java 8), so need to find another (simple, ideally) HTTP client that we can embed.

An initial MVP could be without any "user support" with slash command yet - just a first demo, replacing the symlink (?) in ./test from #379 with example/ running the HTTP server from Gradle.

@edewit FYI

vorburger commented 2 years ago

An alternative design could be to permit doing this the other way around, and "push" (POST / PUT) JS and JARs by HTTP from e.g. a GitHub Codespace to the Minecraft server - secured with some sort of token. In fact, the Blockly UI needs to do this anyway...

edewit commented 2 years ago

Right, blockly right now supports a login with a token so that it can match minecraft user with browser session and then you can just post the JS code.