diff --git a/pom.xml b/pom.xml index 6e6d111..f52fb51 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.viaversion nbt - 4.0.1 + 4.1.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 c61af11..d4ac747 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 @@ -140,6 +140,26 @@ public class CompoundTag extends Tag implements Iterable> { return (T) this.value.get(tagName); } + public @Nullable StringTag getStringTag(String tagName) { + final Tag tag = this.value.get(tagName); + return tag instanceof StringTag ? (StringTag) tag : null; + } + + public @Nullable CompoundTag getCompoundTag(String tagName) { + final Tag tag = this.value.get(tagName); + return tag instanceof CompoundTag ? (CompoundTag) tag : null; + } + + public @Nullable ListTag getListTag(String tagName) { + final Tag tag = this.value.get(tagName); + return tag instanceof ListTag ? (ListTag) tag : null; + } + + public @Nullable NumberTag getNumberTag(String tagName) { + final Tag tag = this.value.get(tagName); + return tag instanceof NumberTag ? (NumberTag) tag : null; + } + /** * Puts the tag into this compound tag. * @@ -258,8 +278,7 @@ public class CompoundTag extends Tag implements Iterable> { tag.write(out); } - // End - out.writeByte(0); + out.writeByte(TagRegistry.END); } @Override