diff --git a/src/main/java/net/querz/nbt/tag/CompoundTag.java b/src/main/java/net/querz/nbt/tag/CompoundTag.java index 9cdc3363..6c754cd7 100644 --- a/src/main/java/net/querz/nbt/tag/CompoundTag.java +++ b/src/main/java/net/querz/nbt/tag/CompoundTag.java @@ -282,7 +282,7 @@ public int compareTo(CompoundTag o) { @Override public CompoundTag clone() { - CompoundTag copy = new CompoundTag(); + CompoundTag copy = new CompoundTag(((int) Math.ceil(getValue().size() * 1.75f)) + 1); for (Map.Entry> e : getValue().entrySet()) { copy.put(e.getKey(), e.getValue().clone()); } diff --git a/src/main/java/net/querz/nbt/tag/ListTag.java b/src/main/java/net/querz/nbt/tag/ListTag.java index 955ad1a4..6f381351 100644 --- a/src/main/java/net/querz/nbt/tag/ListTag.java +++ b/src/main/java/net/querz/nbt/tag/ListTag.java @@ -320,7 +320,7 @@ public int compareTo(ListTag o) { @SuppressWarnings("unchecked") @Override public ListTag clone() { - ListTag copy = new ListTag<>(this.size()); + ListTag copy = new ListTag<>(((int) Math.ceil(this.size() * 1.75)) + 1); // assure type safety for clone copy.typeClass = typeClass; for (T t : getValue()) {