mirror of
https://github.com/ViaVersion/ViaNBT.git
synced 2024-09-30 04:17:34 +02:00
Fixed ListTag
This commit is contained in:
parent
dd7a7522ff
commit
643639c051
@ -267,6 +267,7 @@ public final class NBTInputStream implements Closeable {
|
||||
|
||||
return new ObjectTag(name, o);
|
||||
case NBTConstants.TYPE_SHORT_ARRAY:
|
||||
long time = System.currentTimeMillis();
|
||||
length = is.readInt();
|
||||
short[] shorts = new short[length];
|
||||
|
||||
@ -274,6 +275,7 @@ public final class NBTInputStream implements Closeable {
|
||||
shorts[i] = is.readShort();
|
||||
}
|
||||
|
||||
System.out.println("Took " + (System.currentTimeMillis() - time) + "ms to read a short array.");
|
||||
return new ShortArrayTag(name, shorts);
|
||||
case NBTConstants.TYPE_STRING_ARRAY:
|
||||
length = is.readInt();
|
||||
|
@ -35,15 +35,11 @@ package ch.spacebase.opennbt.tag;
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import ch.spacebase.opennbt.NBTUtils;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The <code>TAG_List</code> tag.
|
||||
*/
|
||||
@ -77,7 +73,7 @@ public final class ListTag<T extends Tag> extends Tag implements Iterable<T> {
|
||||
public ListTag(String name, Class<T> type, List<T> value) {
|
||||
super(name);
|
||||
this.type = type;
|
||||
this.value = Collections.unmodifiableList(value);
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,7 +86,7 @@ public final class ListTag<T extends Tag> extends Tag implements Iterable<T> {
|
||||
|
||||
@Override
|
||||
public List<T> getValue() {
|
||||
return value;
|
||||
return new ArrayList<T>(value);
|
||||
}
|
||||
|
||||
public boolean add(T value) {
|
||||
|
Loading…
Reference in New Issue
Block a user