Code Monkey home page Code Monkey logo

Comments (11)

macfreek avatar macfreek commented on July 28, 2024

Thanks for your report. Either Mojang added another type to the NBT files, or your file somehow got corrupted. If it is not too much trouble, could you email the scoreboard.dat file to me? My email address is on my Github page (http://github.com/macfreek)

from nbt.

schoentoon avatar schoentoon commented on July 28, 2024

File certainly isn't corrupted as both minecraft and my own tool https://github.com/schoentoon/nbtcurses are able to read it. Will email you the scoreboard.dat in a bit.

from nbt.

macfreek avatar macfreek commented on July 28, 2024

Indeed, a bug in the NBT library is a rather likely cause too. :). File received also gives the same error here. I'll have a look, hopefully tonight.

from nbt.

macfreek avatar macfreek commented on July 28, 2024

I found the cause.Your file contains a rather odd TAG_List.

The syntax of a TAG_List is as follows:

  • 1 byte indicating that a TAG_List follows (0x09)
  • 2 bytes indicating the length n of the name of this TAG_List
  • n bytes containing the actual name of the TAG_List
  • 1 byte indicated what type of objects the list contains
  • 4 bytes indicated the number l of objects the TAG_List contains
  • ... l unnamed binary tags containing the objects in the list.

The type of the TAG_List in your file was 0x00 -- a TAG_End, and the length was also 0x00000000 -- zero length. The TAG_End is surprising, and why the NBT library raised the Exception. Normally, a List contains actual objects. So far, I've only seen TAG_Ends used to indicate the end of a TAG_Compound, never elsewhere.

I'll commit a change shortly that should add support for TAG_Lists with TAG_End objects.

>>> from nbt import *
>>> nbtfile = nbt.NBTFile("scoreboard.dat")
>>> print(nbtfile.pretty_tree())
NBTFile: {1 Entries}
{
    TAG_Compound('data'): {4 Entries}
    {
        TAG_List('Teams'): [0 _TAG_End(s)]
        TAG_List('Objectives'): [4 TAG_Compound(s)]
        {
            ....
        }
    }
}

[Edit: fix formatting of list]

from nbt.

schoentoon avatar schoentoon commented on July 28, 2024

Wonderful, will I be able to install this fix through easy_install or will I have to do an install from source?

from nbt.

macfreek avatar macfreek commented on July 28, 2024

Fixed in 0f3ccff

from nbt.

twoolie avatar twoolie commented on July 28, 2024

@macfreek It's probably time to do a new pypy release, yes?

from nbt.

macfreek avatar macfreek commented on July 28, 2024

You will have to install from source -- that said, we should release 1.4 of NBT. For good measure, I won't do it right after a code change, but tomorrow might be a good time.

Ideally, I should write a test for this behaviour. However, if you are willing to download the source, and test if it works fine for you, that would be good enough for me. The automated testing gives no problems either.

from nbt.

macfreek avatar macfreek commented on July 28, 2024

@twoolie yes master, it is Time.

(Sorry, couldn't resist saying that :) )

from nbt.

twoolie avatar twoolie commented on July 28, 2024

@schoentoon you can install it super easily like this:

easy_install pip
pip install git+https://github.com/twoolie/NBT@0f3ccffecb#egg=NBT

from nbt.

schoentoon avatar schoentoon commented on July 28, 2024

@twoolie Oh thanks that's very useful. I'll install it later though, have to explore all the new biomes first ;)

Edit: Confirmed that it fixed my issue.

from nbt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.