Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/main/java/io/xol/enklume/nbt/NBTLongArray.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
}

4 changes: 3 additions & 1 deletion src/main/java/io/xol/enklume/nbt/NBTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
}
}