Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Includes several fixes:
Updates jdataview to lowercase dependency name to fix missing dependency error (see https://www.npmjs.org/package/jDataView vs https://www.npmjs.org/package/jdataview)
Uses
getInt64
instead ofgetFloat64
to fix parsingTAG_Long
– previously, would interpret the data as a float, leading to very small numbers:"firstPlayed": 6.75790774786e-312,
with jdataview 64-bit integers, split into two 32-bits:
which matches the value compared with NBTExplorer (318*Math.pow(2,32) + 2016155682 = 1367815755810):
parsed correctly as '§eElectric' (raw bytes: \xc2\xa7 utf8, decode as U+00A7). Before this would decode as '§eElectric'
P.S. @maxogden: any interest in merging this module with @sjmulder's https://github.com/sjmulder/nbt-js ('nbt' in npm)? It has been inactive (3 years) not sure if @sjmulder is still up for maintaining it but I think it has a cleaner implementation than this module ('minecraft-nbt'), written directly in JavaScript instead of updated translated from CoffeeScript; though it is using a bundled binary decoding library instead of jdataview. Would be cool to have one ultimate NBT library =) considering preserving the interface of minecraft-nbt (so minecraft-mca/region or any other users wouldn't have to change) but replacing the guts with 'nbt'. Maybe https://github.com/andrewrk/node-minecraft-protocol could even use it too? (cc @andrewrk @roblabla)