mirror of
https://github.com/ViaVersion/ViaNBT.git
synced 2024-11-26 12:15:19 +01:00
4.1.0: Add helper getters to CompoundTag
This commit is contained in:
parent
18754b7774
commit
ea616b1e44
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.viaversion</groupId>
|
||||
<artifactId>nbt</artifactId>
|
||||
<version>4.0.1</version>
|
||||
<version>4.1.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>ViaNBT</name>
|
||||
|
@ -140,6 +140,26 @@ public class CompoundTag extends Tag implements Iterable<Entry<String, Tag>> {
|
||||
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<Entry<String, Tag>> {
|
||||
tag.write(out);
|
||||
}
|
||||
|
||||
// End
|
||||
out.writeByte(0);
|
||||
out.writeByte(TagRegistry.END);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user