Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,10 @@
"name": "net.hollowcube.mapmaker.runtime.parkour.ParkourState$AnyPlaying",
"allDeclaredClasses": true,
"allPermittedSubclasses": true
},
{
"name": "net.hollowcube.mapmaker.runtime.freeform.FreeformState",
"allDeclaredClasses": true,
"allPermittedSubclasses": true
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
},
{
"pattern": "\\Qdefault_config.json\\E"
},
{
"pattern": "net\\.hollowcube\\.scripting/(.+)\\.zip"
}
]
}
Expand Down
5 changes: 0 additions & 5 deletions bin/example/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ plugins {
id("mapmaker.packer-data")
}

repositories {
mavenLocal()
mavenCentral()
}

dependencies {
implementation(project(":bin:config"))

Expand Down
5 changes: 0 additions & 5 deletions bin/hub/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ plugins {
id("mapmaker.packer-data")
}

repositories {
mavenLocal()
mavenCentral()
}

dependencies {
implementation(project(":bin:config"))

Expand Down
13 changes: 7 additions & 6 deletions bin/map-isolate/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
plugins {
id("mapmaker.java-binary")
id("mapmaker.packer-data")
id("org.graalvm.buildtools.native") version "0.10.6"
}

repositories {
mavenLocal()
mavenCentral()
id("org.graalvm.buildtools.native") version "0.11.0"
}

dependencies {
Expand Down Expand Up @@ -50,6 +45,7 @@ tasks.nativeCompile {

application {
mainClass = "net.hollowcube.mapmaker.isolate.IsolateMain"
applicationDefaultJvmArgs = listOf("--enable-native-access=ALL-UNNAMED")
}

graalvmNative {
Expand All @@ -59,6 +55,11 @@ graalvmNative {
buildArgs(
listOf(
"--enable-native-access=ALL-UNNAMED", "--enable-monitoring=jfr",
"-H:+UnlockExperimentalVMOptions", "-H:+ForeignAPISupport",
"-H:+MLProfileInferenceUseGNNModel",

"-H:+UseCompressedReferences",

"--features=net.hollowcube.nativeimage.HCNativeImageFeature",
"--static-nolibc", "--no-fallback",
"--emit build-report",
Expand Down
3 changes: 2 additions & 1 deletion bin/map-isolate/deploy/Dockerfile-native
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM gcr.io/distroless/base
#FROM gcr.io/distroless/cc
FROM debian:trixie-slim

USER 65532:65532

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
import net.hollowcube.common.util.FutureUtil;
import net.hollowcube.common.util.Uuids;
import net.hollowcube.mapmaker.config.ConfigLoaderV3;
import net.hollowcube.mapmaker.map.AbstractMapWorld;
import net.hollowcube.mapmaker.map.runtime.AbstractMapServer;
import net.hollowcube.mapmaker.map.runtime.ServerBridge;
import net.hollowcube.mapmaker.misc.ResourcePackManager;
import net.hollowcube.mapmaker.runtime.freeform.FreeformMapWorld;
import net.hollowcube.mapmaker.runtime.freeform.bundle.LocalFsLoader;
import net.hollowcube.mapmaker.runtime.freeform.bundle.ResourcesLoader;
import net.hollowcube.mapmaker.runtime.freeform.bundle.ScriptBundle;
import net.hollowcube.mapmaker.runtime.parkour.ParkourMapWorld;
import net.hollowcube.mapmaker.session.Presence;
import net.kyori.adventure.text.Component;
Expand All @@ -21,34 +26,42 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.UUID;

import static net.hollowcube.mapmaker.map.MapPlayer.simpleMapPlayer;

public class MapIsolateServer extends AbstractMapServer {
private static final Logger logger = LoggerFactory.getLogger(MapIsolateServer.class);

private final ScriptBundle.Loader scriptLoader;

private final String mapId;

// Its only kinda unknown. it's not created in the constructor, but after prepareState
// it is always not-null which should cover any reasonable logic.
// TODO: pretty sure we could do init in constructor, should investigate.
private @UnknownNullability ParkourMapWorld world;
private @UnknownNullability AbstractMapWorld<?, ?> world;

public MapIsolateServer(ConfigLoaderV3 config) {
super(config);

if (IsolateMain.args.length < 1)
throw new IllegalArgumentException("Map ID must be provided as the last argument");
this.mapId = UUID.fromString(IsolateMain.args[IsolateMain.args.length - 1]).toString();
System.out.println("Map ID: " + this.mapId);
System.out.println("Args: " + Arrays.toString(IsolateMain.args));
logger.info("Loading map {}", this.mapId);

MinecraftServer.getGlobalEventHandler().addChild(EventNode.all("map-init")
.addListener(AsyncPlayerConfigurationEvent.class, this::handleConfigPhase)
.addListener(PlayerSpawnEvent.class, this::handleSpawn)
.addListener(PlayerDisconnectEvent.class, this::handleDisconnect));

var scriptsDirectory = Path.of("../../scripts");
this.scriptLoader = Files.exists(scriptsDirectory)
? new LocalFsLoader(scriptsDirectory)
: new ResourcesLoader();
logger.info("Using script loader: {}", this.scriptLoader);
}

@Override
Expand Down Expand Up @@ -78,7 +91,7 @@ protected void prepareStart() {
try {
var map = mapService().getMap(Uuids.ZERO, this.mapId);

world = new ParkourMapWorld(this, map);
world = new FreeformMapWorld(this, map, scriptLoader);
world.loadWorld();

// We schedule on first tick end because submitTask invokes the executor immediately to determine
Expand Down
5 changes: 0 additions & 5 deletions bin/map/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ plugins {
id("mapmaker.packer-data")
}

repositories {
mavenLocal()
mavenCentral()
}

dependencies {
implementation(project(":bin:config"))

Expand Down
11 changes: 11 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ blossom = "2.1.0"
velocity = "3.4.0-SNAPSHOT"
classgraph = "4.8.179"
included = "-INCLUDED"
luau = "0.5.1"
luau-natives = "0.5.1"
javapoet = "0.7.0"

[libraries]
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
Expand All @@ -50,6 +53,7 @@ jctools = { group = "org.jctools", name = "jctools-core", version.ref = "jctools
caffeine = { group = "com.github.ben-manes.caffeine", name = "caffeine", version.ref = "caffeine" }
json5 = { group = "de.marhali", name = "json5-java", version.ref = "json5" }
velocity-api = { group = "com.velocitypowered", name = "velocity-api", version.ref = "velocity" }
javapoet = { group = "com.palantir.javapoet", name = "javapoet", version.ref = "javapoet" }

included-molang = { group = "dev.hollowcube", name = "molang", version.ref = "included" }
included-schem = { group = "dev.hollowcube", name = "schem", version.ref = "included" }
Expand All @@ -63,6 +67,12 @@ adventure-text-minimessage = { group = "net.kyori", name = "adventure-text-minim
adventure-text-serializer-plain = { group = "net.kyori", name = "adventure-text-serializer-plain", version.ref = "adventure" }
adventure-nbt = { group = "net.kyori", name = "adventure-nbt", version.ref = "adventure" }

luau-lib = { group = "dev.hollowcube", name = "luau", version.ref = "luau" }
luau-natives-macos-x64 = { group = "dev.hollowcube", name = "luau-natives-macos-x64", version.ref = "luau-natives" }
luau-natives-macos-arm64 = { group = "dev.hollowcube", name = "luau-natives-macos-arm64", version.ref = "luau-natives" }
luau-natives-linux-x64 = { group = "dev.hollowcube", name = "luau-natives-linux-x64", version.ref = "luau-natives" }
luau-natives-windows-x64 = { group = "dev.hollowcube", name = "luau-natives-windows-x64", version.ref = "luau-natives" }

prometheus = { group = "io.prometheus", name = "simpleclient", version.ref = "prometheus" }
prometheus-hotspot = { group = "io.prometheus", name = "simpleclient_hotspot", version.ref = "prometheus" }
prometheus-httpserver = { group = "io.prometheus", name = "simpleclient_httpserver", version.ref = "prometheus" }
Expand All @@ -86,6 +96,7 @@ junit-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", ver
adventure = ["adventure-api", "adventure-key", "adventure-text-minimessage", "adventure-text-serializer-plain", "adventure-nbt"]
prometheus = ["prometheus", "prometheus-hotspot", "prometheus-httpserver"]
otel = ["otel-api", "otel-context", "otel-sdk", "otel-sdk-common", "otel-sdk-trace", "otel-extension-trace-propagators", "otel-exporter-logging", "otel-exporter-otlp", "otel-exporter-sender-jdk", "otel-semconv"]
luau = ["luau-lib", "luau-natives-macos-x64", "luau-natives-macos-arm64", "luau-natives-linux-x64", "luau-natives-windows-x64"]

[plugins]
blossom = { id = "net.kyori.blossom", version.ref = "blossom" }
159 changes: 159 additions & 0 deletions idea/Luau-Formatter.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
{
"cells": [
{
"cell_type": "code",
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2025-09-22T02:14:42.446744Z",
"start_time": "2025-09-22T02:14:42.237492Z"
}
},
"source": [
"%use intellij-platform\n",
"loadPlugins(\"com.intellij.java\")"
],
"outputs": [],
"execution_count": 2
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-09-22T02:25:10.879859Z",
"start_time": "2025-09-22T02:25:10.732760Z"
}
},
"cell_type": "code",
"source": [
"import com.intellij.psi.PsiElement\n",
"import com.intellij.psi.PsiMethod\n",
"import com.intellij.psi.PsiReference\n",
"import com.intellij.psi.javadoc.CustomJavadocTagProvider\n",
"import com.intellij.psi.javadoc.JavadocTagInfo\n",
"import com.intellij.psi.javadoc.PsiDocTagValue\n",
"import org.jetbrains.annotations.Nls\n",
"\n",
"registerProjectExtension(JavadocTagInfo.EP_NAME.name, object : JavadocTagInfo {\n",
" override fun getName() = \"luaReturn\"\n",
"\n",
" override fun isInline() = false\n",
"\n",
" override fun isValidInContext(context: PsiElement?) = context is PsiMethod\n",
"\n",
" override fun checkTagValue(value: PsiDocTagValue?) = null\n",
"\n",
" override fun getReference(p0: PsiDocTagValue?) = null\n",
"})\n",
"\n",
"registerProjectExtension(JavadocTagInfo.EP_NAME.name, object : JavadocTagInfo {\n",
" override fun getName() = \"luaParam\"\n",
"\n",
" override fun isInline() = false\n",
"\n",
" override fun isValidInContext(context: PsiElement?) = context is PsiMethod\n",
"\n",
" override fun checkTagValue(value: PsiDocTagValue?) = null\n",
"\n",
" override fun getReference(p0: PsiDocTagValue?) = null\n",
"})"
],
"outputs": [],
"execution_count": 8
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2025-09-17T01:48:46.144155Z",
"start_time": "2025-09-17T01:48:46.021185Z"
}
},
"cell_type": "code",
"source": [
"import com.intellij.execution.configurations.GeneralCommandLine\n",
"import com.intellij.execution.process.CapturingProcessAdapter\n",
"import com.intellij.execution.process.OSProcessHandler\n",
"import com.intellij.execution.process.ProcessEvent\n",
"import com.intellij.formatting.service.AsyncDocumentFormattingService\n",
"import com.intellij.formatting.service.AsyncFormattingRequest\n",
"import com.intellij.formatting.service.FormattingService\n",
"import com.intellij.openapi.util.NlsSafe\n",
"import com.intellij.psi.PsiFile\n",
"import java.nio.charset.StandardCharsets\n",
"import java.util.EnumSet\n",
"\n",
"class StyluaFormatter : AsyncDocumentFormattingService() {\n",
"\n",
" override fun getName() = \"StyLua Formatter\"\n",
"\n",
" override fun getNotificationGroupId() = \"StyLua Formatter\"\n",
"\n",
" override fun getFeatures() = EnumSet.noneOf(FormattingService.Feature::class.java)\n",
"\n",
" override fun canFormat(file: PsiFile): Boolean {\n",
" return file.virtualFile.extension == \"luau\"\n",
" }\n",
"\n",
" override fun createFormattingTask(request: AsyncFormattingRequest): FormattingTask? {\n",
" val path = request.ioFile?.toPath() ?: return null\n",
"\n",
" val commandLine = GeneralCommandLine()\n",
" .withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE)\n",
" .withExePath(\"stylua\")\n",
" .withWorkingDirectory(path.parent)\n",
" .withParameters(\"--no-editorconfig\", \"-\")\n",
" .withInput(request.ioFile)\n",
" val handler = OSProcessHandler(commandLine.withCharset(StandardCharsets.UTF_8))\n",
" return object : FormattingTask {\n",
" override fun run() {\n",
" handler.addProcessListener(object : CapturingProcessAdapter() {\n",
" override fun processTerminated(event: ProcessEvent) {\n",
" if (event.exitCode == 0) {\n",
" request.onTextReady(output.stdout)\n",
" } else {\n",
" request.onTextReady(output.stderr)\n",
" }\n",
" }\n",
" })\n",
" handler.startNotify()\n",
" }\n",
"\n",
" override fun cancel(): Boolean {\n",
" handler.destroyProcess()\n",
" return true\n",
" }\n",
"\n",
" override fun isRunUnderProgress(): Boolean {\n",
" return true\n",
" }\n",
" }\n",
" }\n",
"}\n",
"\n",
"registerExtension(FormattingService.EP_NAME, StyluaFormatter())"
],
"outputs": [],
"execution_count": 4
}
],
"metadata": {
"kernelspec": {
"display_name": "Kotlin",
"language": "kotlin",
"name": "kotlin"
},
"language_info": {
"name": "kotlin",
"version": "2.2.20-Beta2",
"mimetype": "text/x-kotlin",
"file_extension": ".kt",
"pygments_lexer": "kotlin",
"codemirror_mode": "text/x-kotlin",
"nbconvert_exporter": ""
},
"ktnbPluginMetadata": {
"sessionRunMode": "IDE_PROCESS"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Loading