diff --git a/src/main/java/io/xol/enklume/nbt/NBTLongArray.java b/src/main/java/io/xol/enklume/nbt/NBTLongArray.java new file mode 100644 index 0000000..ac5eb6f --- /dev/null +++ b/src/main/java/io/xol/enklume/nbt/NBTLongArray.java @@ -0,0 +1,33 @@ +package io.xol.enklume.nbt; + +import java.io.IOException; +import java.io.DataInputStream; + +public class NBTLongArray extends NBTNamed { + + int size; + public long[] data; + + @Override + void feed(DataInputStream is) throws IOException { + super.feed(is); + size = is.read() << 24; + size += is.read() << 16; + size += is.read() << 8; + size += is.read(); + + data = new long[size]; + for (int i = 0; i < size; i++) { + long y = is.read() << 56; + y += is.read() << 48; + y += is.read() << 40; + y += is.read() << 32; + y += is.read() << 24; + y += is.read() << 16; + y += is.read() << 8; + y += is.read(); + data[i] = y; + } + } +} + diff --git a/src/main/java/io/xol/enklume/nbt/NBTag.java b/src/main/java/io/xol/enklume/nbt/NBTag.java index 21ced94..ab66d70 100644 --- a/src/main/java/io/xol/enklume/nbt/NBTag.java +++ b/src/main/java/io/xol/enklume/nbt/NBTag.java @@ -78,6 +78,8 @@ private static NBTag create(Type t) { return new NBTByteArray(); case TAG_INT_ARRAY: return new NBTIntArray(); + case TAG_LONG_ARRAY: + return new NBTLongArray(); default: System.out.println("Unknow type : " + t.name()); break; @@ -86,6 +88,6 @@ private static NBTag create(Type t) { } public enum Type { - TAG_END, TAG_BYTE, TAG_SHORT, TAG_INT, TAG_LONG, TAG_FLOAT, TAG_DOUBLE, TAG_BYTE_ARRAY, TAG_STRING, TAG_LIST, TAG_COMPOUND, TAG_INT_ARRAY + TAG_END, TAG_BYTE, TAG_SHORT, TAG_INT, TAG_LONG, TAG_FLOAT, TAG_DOUBLE, TAG_BYTE_ARRAY, TAG_STRING, TAG_LIST, TAG_COMPOUND, TAG_INT_ARRAY, TAG_LONG_ARRAY } }