fix(UC-02): clean theme IDs — strip directory prefix and .json suffix

RISK-003: Definition IDs were "tiedup:tiedup_room_themes/oubliette.json"
instead of clean "tiedup:oubliette". Now derived from filename only.
This commit is contained in:
NotEvil
2026-04-16 01:54:03 +02:00
parent 6d9d6b4b81
commit 8823c671d7

View File

@@ -59,8 +59,14 @@ public class RoomThemeReloadListener
ResourceLocation fileId = entry.getKey(); ResourceLocation fileId = entry.getKey();
Resource resource = entry.getValue(); Resource resource = entry.getValue();
// Derive clean ID from file path: "tiedup:tiedup_room_themes/oubliette.json" -> "tiedup:oubliette"
String cleanPath = fileId.getPath()
.replace(DIRECTORY + "/", "")
.replace(".json", "");
ResourceLocation cleanId = new ResourceLocation(fileId.getNamespace(), cleanPath);
try (InputStream input = resource.open()) { try (InputStream input = resource.open()) {
RoomThemeDefinition def = RoomThemeParser.parse(input, fileId); RoomThemeDefinition def = RoomThemeParser.parse(input, cleanId);
if (def != null) { if (def != null) {
// Check for duplicate IDs (fileId IS the ID for room themes) // Check for duplicate IDs (fileId IS the ID for room themes)