Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

RangeError when attempting to parse mcedit schematic file #39

Closed
lancewellspring opened this issue Apr 17, 2019 · 1 comment
Closed

Comments

@lancewellspring
Copy link

lancewellspring commented Apr 17, 2019

nbt.js:403 Uncaught RangeError: Offset is outside the bounds of the DataView
at DataView.getInt8 ()
at nbt.Reader.read (nbt.js:403)
at Object.nbt.parseUncompressed (nbt.js:599)
at Object.nbt.parse (nbt.js:647)

I've tried several different schematics from several different websites, and they all give the same error. I've attached a schematic file that gives the error. According to the mcedit wiki, the schematic file format follows the nbt format, so I was hoping this script would work.

Webpage is served from a Debian server, and the script is being run via latest Chrome, on windows 10.

simple-contemporary.zip

@lancewellspring
Copy link
Author

The problem was on my end. I was returning the schematic file from Node.js Express, and the jQuery ajax function I was using was interpreting it as a string. Using the code found at: https://www.henryalgus.com/reading-binary-files-using-jquery-ajax/, I was able to get the data as an ArrayBuffer instead, which fixed the problem.

As a side note, nbt.js doesn't work properly in the browser. It expects window.zlib to be available, but I couldn't figure out how to get that working. So I just added a reference to pako, and modified nbt.js slightly to use pako.inflate instead of zlib.gunzip.

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

No branches or pull requests

1 participant