Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Generates and compiles mapping files for Via*. Current mapping files can be foun
## Non-technical editing of existing mappings

If you're just here to edit an existing mapping of a block, item, or an entity name, you can use the helper UI.
Via IntelliJ or the command line, run `BlockStateMappingUi` main function. After generating the output NBT files,
Run the `MappingUi` main function via IntelliJ or via the command line with `./gradlew runUi`. After generating the output NBT files,
you can find them in the `output/` directory.

## Generating json mapping files for a Minecraft version
Expand Down
11 changes: 11 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,15 @@ tasks {
test {
useJUnitPlatform()
}

register<JavaExec>("runUi") {
group = "application"
description = "Starts the mapping helper UI"
mainClass.set("com.viaversion.mappingsgenerator.helper.MappingUi")
classpath = sourceSets["main"].runtimeClasspath
standardInput = System.`in`
if (project.hasProperty("args")) {
args = (project.property("args") as String).split(" ")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,20 @@ private static void sendCopyResult(final HttpExchange exchange, final CopyResult
}

private static Path ideaProjectsDir() {
final Path parent = Path.of("").toAbsolutePath().getParent();
if (parent != null && (Files.exists(parent.resolve("ViaVersion")) || Files.exists(parent.resolve("viaversion"))
|| Files.exists(parent.resolve("ViaBackwards")) || Files.exists(parent.resolve("viabackwards")))) {
return parent;
}
return Path.of(System.getProperty("user.home"), "IdeaProjects");
}

private static Path viaVersionResourceDir() {
return ideaProjectsDir().resolve("ViaVersion").resolve("common").resolve("src").resolve("main").resolve("resources")
Path base = ideaProjectsDir().resolve("ViaVersion");
if (!Files.exists(base)) {
base = ideaProjectsDir().resolve("viaversion");
}
return base.resolve("common").resolve("src").resolve("main").resolve("resources")
.resolve("assets").resolve("viaversion");
}

Expand All @@ -234,7 +243,11 @@ private static Path viaVersionDataDir() {
}

private static Path viaBackwardsDataDir() {
return ideaProjectsDir().resolve("ViaBackwards").resolve("common").resolve("src").resolve("main").resolve("resources")
Path base = ideaProjectsDir().resolve("ViaBackwards");
if (!Files.exists(base)) {
base = ideaProjectsDir().resolve("viabackwards");
}
return base.resolve("common").resolve("src").resolve("main").resolve("resources")
.resolve("assets").resolve("viabackwards").resolve("data");
}

Expand Down