Giter Club home page Giter Club logo

nbt's People

Contributors

andrewgraber avatar kashike avatar kitskub avatar lukespragg avatar raphfrk avatar zhuowei avatar zml2008 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nbt's Issues

Error parsing region files?

Tried using this to parse region files and I'm getting an error right away.

new NBTInputStream(file, false).readTag()

causes an IOException with the message "TAG_End found without a TAG_Compound/TAG_List tag preceding it."

Not really sure what's happening there

Save the TagType of lists

The ListTag class has an attribute:

private final Class<T> type;

This is fine and helpful, but most of the time I'm more interested in the TagType of the children. I know TagType and Class names are a 1:1 mapping, but it feels wrong to use "secondary" data (the class) to convert it back into "primary" data (the tag type as specified in the file).

I know having the class is useful and may be important for Generics reasons, but is it possible to add the tag type of the children anyway?

Switch package

Should we change package from flowpowered to spongepowered like in noise and math?

ShortArrayTag?

The TagType class defines:

TAG_COMPOUND(CompoundTag.class, "TAG_Compound", 10),
TAG_INT_ARRAY(IntArrayTag.class, "TAG_Int_Array", 11),
TAG_SHORT_ARRAY(ShortArrayTag.class, "TAG_Short_Array", 100),;

What is a "short array"? The inofficial documentation I found (Minecraft wiki in different languages as well as wiki.vg) has no short array. Instead, there should be a long array with ID 12. And why does it have ID 100?

I haven't looked at the original Minecraft source code though.

LITTLE_ENDIAN Floats and Doubles are read as BIG_ENDIAN

https://github.com/flow/nbt/blob/7a1b6d986e6fbd01862356d47827b8b357349a22/src/main/java/com/flowpowered/nbt/stream/EndianSwitchableInputStream.java#L100-L122

As you can see, readInt() and readLong() take care of the endian ness, but readFloat() and readDouble() also try to take care of flipping the bytes around! This causes LITTLE_ENDIAN Floats and Doubles to be read as BIG_ENDIAN.

    public float readFloat() throws IOException {
        return Float.intBitsToFloat(readInt());
    }

    public double readDouble() throws IOException {
        return Double.longBitsToDouble(readLong());
    }

That should fix it.

If someone could sneak that into there next PR that would be nice! ;) Fixed in PR #16

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.