You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Loading a pre-made map into a dynamically created world (plugin API
#4459
Hey, I'm currently porting a Minestom minigame (Target) over to a WASM plugin.
Currently, it is not possible to load a pre-made map when creating a world from a WASM plugin. Using one world per match with server.create_world(name, dim) + teleport_world works fine for isolation. Problem is create_world only generates a blank overworld rn. It's also not possible to drop .mca region files into the new world folder from the plugin, since the WASI filesystem permissions (fs.read.data / fs.write.data) are limited to the plugin's own data folder. Also tried the obvious workaround of making the plugin's data folder a symlink into world/, but the host rejects paths outside the sandbox at open time.
I've searched existing issues and couldn't find a duplicate (#976 is a one-shot vanilla import chunk bug, and #4109 is the create_world freeze on Linux). Also looked through the WIT definitions in pumpkin-plugin-wit just in case I missed something.
Would an API for world templates be in scope here?
Simplest solution imo is adding server.create_world_from_template(name, template, dim). On the host side Pumpkin just copies world/_templates/{template}/ into world/{name}/ (making sure the path doesn't do any ../ traversal out of the folder) and loads it normally. That way I can just drop my map folders into _templates before starting the server. Also thought about a clone_world(src, dst) fn, or some kind of delete_world cleanup when a match ends, idk if you guys already have plans for ephemeral minigame worlds? Having to register every template map inside configuration.toml just to clone it feels kinda clunky tbh.
Figured I'd ask in discussions first like CONTRIBUTING says before touching the WIT / host functions. Happy to put together a PR if you're ok with this design!
enhancementNew feature or requestapiAnything that deals with Pumpkin's plugin APIworldChunk/region loading, world ticking & updates (stuff other than worldgen)
1 participant
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hey, I'm currently porting a Minestom minigame (Target) over to a WASM plugin.
Currently, it is not possible to load a pre-made map when creating a world from a WASM plugin. Using one world per match with server.create_world(name, dim) + teleport_world works fine for isolation. Problem is create_world only generates a blank overworld rn. It's also not possible to drop .mca region files into the new world folder from the plugin, since the WASI filesystem permissions (fs.read.data / fs.write.data) are limited to the plugin's own data folder. Also tried the obvious workaround of making the plugin's data folder a symlink into world/, but the host rejects paths outside the sandbox at open time.
I've searched existing issues and couldn't find a duplicate (#976 is a one-shot vanilla import chunk bug, and #4109 is the create_world freeze on Linux). Also looked through the WIT definitions in pumpkin-plugin-wit just in case I missed something.
Would an API for world templates be in scope here?
Simplest solution imo is adding server.create_world_from_template(name, template, dim). On the host side Pumpkin just copies world/_templates/{template}/ into world/{name}/ (making sure the path doesn't do any ../ traversal out of the folder) and loads it normally. That way I can just drop my map folders into _templates before starting the server. Also thought about a clone_world(src, dst) fn, or some kind of delete_world cleanup when a match ends, idk if you guys already have plans for ephemeral minigame worlds? Having to register every template map inside configuration.toml just to clone it feels kinda clunky tbh.
Figured I'd ask in discussions first like CONTRIBUTING says before touching the WIT / host functions. Happy to put together a PR if you're ok with this design!
All reactions