8000 Support for POI mca files? · Issue #92 · Querz/NBT · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Support for POI mca files? #92
Open
@Charlweed

Description

@Charlweed

It seems that neither NBTUtil nor MCAUtil can read Minecraft POI files, as found in foo/world/poi.
I am expecting to find data as described in this fandom wiki
MCAUtil fails with "java.lang.IllegalArgumentException: data does not contain "Level" tag" at "net.querz.mca.Chunk.initReferences(Chunk.java:71)"
I tried this method, and I have not been able to get any tag content.

    public static void readPOIMCAs() {
        final String POI_DIR_STR = "L:\\bin\\minecraft-server\\server_instance\\latest\\world\\poi";
        java.nio.file.Path poi_dir = Path.of(POI_DIR_STR);
        if (!Files.exists(poi_dir)) {
            IOException inner = new IOException("Could not find directory " + poi_dir);
            throw new RuntimeException(inner);
        }
        LOGGER.info("Scanning files in " + poi_dir);
        Set<Path> mcaPaths = new HashSet<>();
        try (DirectoryStream<Path> stream = Files.newDirectoryStream(poi_dir)) {
            for (Path path : stream) {
                String fileName = path.getFileName().toString();
                if (fileName.matches("r\\..+\\.mca")) {
                    mcaPaths.add(path);
                }
            }
            LOGGER.info(String.format("POI dir \"%s\" has %d mca files", poi_dir, mcaPaths.size()));
            for(Path mcaPath : mcaPaths){
                String mcaFileString = mcaPath.toAbsolutePath().toString();
                // MCAFile mcaFile = MCAUtil.read(mcaFileString);
                NamedTag namedTag = NBTUtil.read(mcaFileString);
                String tagName= namedTag.getName();
                Tag<?> innerTag = namedTag.getTag();
                String snbt = SNBTUtil.toSNBT(innerTag);
                LOGGER.info(String.format("File: %s; Tag \"%s\"; SNBT: \"%s\"; JSON: %s", mcaFileString, tagName, snbt,innerTag.toString()));
            }
        }
        catch (IOException ioe) {
            throw new RuntimeException(ioe);
        }
    }
    

There is no content from snbt nor json. The log output here looks like:

INFO: File: L:\bin\minecraft-server\server_instance\latest\world\poi\r.1.2.mca; Tag ""; SNBT: ""; JSON: {"type":"EndTag","value":"end"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0