Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with minecraft version 1.18.1 #60

Open
DevanshRathi1 opened this issue Jan 24, 2022 · 4 comments
Open

Not working with minecraft version 1.18.1 #60

DevanshRathi1 opened this issue Jan 24, 2022 · 4 comments

Comments

@DevanshRathi1
Copy link

DevanshRathi1 commented Jan 24, 2022

Package version: 2.1.0
Node version: 16.13.0

I am trying to read a .mca file that was made by minecraft version 1.18.1.

This is the code that produced the issue (it is the same as the example in the README):

import fs from "fs/promises";
import nbt from "prismarine-nbt";

async function test() {
    const buffer = await fs.readFile(`${directory}/r.0.0.mca`);
    const { parsed, type } = await nbt.parse(buffer);
    console.log("JSON serialized", JSON.stringify(parsed, null, 2));
    fs.createWriteStream("file.nbt").write(nbt.writeUncompressed(parsed, type)); // Write it back
}

test();

Error:

undefined:32
        if (c === '\0') throw new Error('unexpected tag end')
                              ^

Error: Read error for undefined : unexpected tag end
    at Object.readPString [as nbtTagName] (eval at compile (/Users/<directory>node_modules/protodef/src/compiler.js:258:12), <anonymous>:32:31)
    at nbt (eval at compile (/Users/<directory>node_modules/protodef/src/compiler.js:258:12), <anonymous>:150:61)
    at CompiledProtodef.read (/Users/<directory>node_modules/protodef/src/compiler.js:70:12)
    at e.message (/Users/<directory>node_modules/protodef/src/compiler.js:111:49)
    at tryCatch (/Users/<directory>node_modules/protodef/src/utils.js:50:16)
    at CompiledProtodef.parsePacketBuffer (/Users/<directory>node_modules/protodef/src/compiler.js:111:29)
    at parseAs (/Users/<directory>node_modules/prismarine-nbt/nbt.js:63:31)
    at Object.parse (/Users/<directory>node_modules/prismarine-nbt/nbt.js:121:17)
    at test (file:///Users/<directory>server/trial/nbt.js:11:40)
@rom1504
Copy link
Member

rom1504 commented Jan 24, 2022 via email

@electrovir
Copy link

I'm getting the same error on region data in 1.19

@meza
Copy link

meza commented Dec 25, 2023

Same with 1.20.2

@rom1504
Copy link
Member

rom1504 commented Dec 25, 2023

Completely different topic for 1.20.2, please open another issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants