diff --git a/pom.xml b/pom.xml index 78aed2f..e4607e3 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.viaversion nbt - 3.3.0 + 3.4.0 jar ViaNBT diff --git a/src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java b/src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java index 8212d59..0ca1949 100644 --- a/src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java +++ b/src/main/java/com/github/steveice10/opennbt/tag/builtin/CompoundTag.java @@ -112,9 +112,9 @@ public class CompoundTag extends Tag implements Iterable> { /** * Puts the tag into this compound tag. * - * @param Type of tag to put. + * @param Type of tag to put. * @param tagName Name of the tag. - * @param tag Tag to put into this compound tag. + * @param tag Tag to put into this compound tag. * @return The previous tag associated with its name, or null if there wasn't one. */ @Nullable @@ -122,6 +122,42 @@ public class CompoundTag extends Tag implements Iterable> { return (T) this.value.put(tagName, tag); } + public void putString(String tagName, String value) { + this.value.put(tagName, new StringTag(value)); + } + + public void putByte(String tagName, byte value) { + this.value.put(tagName, new ByteTag(value)); + } + + public void putInt(String tagName, int value) { + this.value.put(tagName, new IntTag(value)); + } + + public void putShort(String tagName, short value) { + this.value.put(tagName, new ShortTag(value)); + } + + public void putLong(String tagName, long value) { + this.value.put(tagName, new LongTag(value)); + } + + public void putFloat(String tagName, float value) { + this.value.put(tagName, new FloatTag(value)); + } + + public void putDouble(String tagName, double value) { + this.value.put(tagName, new DoubleTag(value)); + } + + public void putBoolean(String tagName, boolean value) { + this.value.put(tagName, new ByteTag((byte) (value ? 1 : 0))); + } + + public void putAll(CompoundTag compoundTag) { + this.value.putAll(compoundTag.value); + } + /** * Removes a tag from this compound tag. * diff --git a/src/main/java/com/github/steveice10/opennbt/tag/builtin/ListTag.java b/src/main/java/com/github/steveice10/opennbt/tag/builtin/ListTag.java index 04f213a..087f3bd 100644 --- a/src/main/java/com/github/steveice10/opennbt/tag/builtin/ListTag.java +++ b/src/main/java/com/github/steveice10/opennbt/tag/builtin/ListTag.java @@ -134,6 +134,10 @@ public class ListTag extends Tag implements Iterable { return this.value.size(); } + public boolean isEmpty() { + return this.value.isEmpty(); + } + @Override public Iterator iterator() { return this.value.iterator();