diff --git a/docs/scarpet/api/Overview.md b/docs/scarpet/api/Overview.md index 7c08b451..4f1da73c 100644 --- a/docs/scarpet/api/Overview.md +++ b/docs/scarpet/api/Overview.md @@ -6,7 +6,8 @@ Here is the gist of the Minecraft related functions. Otherwise the CarpetScript ## App structure The main delivery method for scarpet programs into the game is in the form of apps in `*.sc` files located in the world `scripts` -folder. In singleplayer, you can also save apps in `.minecraft/config/carpet/scripts` for them to be available in any world. +folder, flat. In singleplayer, you can also save apps in `.minecraft/config/carpet/scripts` for them to be available in any world, +and here you can actually organize them in folders. When loaded (via `/script load` command, etc.), the game will run the content of the app once, regardless of its scope (more about the app scopes below), without executing of any functions, unless called directly, and with the exception of the `__config()` function, if present, which will be executed once. Loading the app will also bind specific diff --git a/src/main/java/carpet/script/CarpetScriptServer.java b/src/main/java/carpet/script/CarpetScriptServer.java index d7090999..b515489e 100644 --- a/src/main/java/carpet/script/CarpetScriptServer.java +++ b/src/main/java/carpet/script/CarpetScriptServer.java @@ -149,7 +149,7 @@ public class CarpetScriptServer { Path globalFolder = FabricLoader.getInstance().getConfigDir().resolve("carpet/scripts"); Files.createDirectories(globalFolder); - scriptPath = Files.list(globalFolder) + scriptPath = Files.walk(globalFolder) .filter(script -> script.getFileName().toString().equalsIgnoreCase(name + ".sc") || (allowLibraries && script.getFileName().toString().equalsIgnoreCase(name + ".scl"))) .findFirst(); @@ -194,7 +194,7 @@ public class CarpetScriptServer try { Path worldScripts = server.getSavePath(WorldSavePath.ROOT).resolve("scripts"); Files.createDirectories(worldScripts); - Files.walk(worldScripts) + Files.list(worldScripts) .filter(f -> f.toString().endsWith(".sc")) .forEach(f -> moduleNames.add(f.getFileName().toString().replaceFirst("\\.sc$","").toLowerCase(Locale.ROOT)));