3.1.0 Release

Add NumberTag#asBoolean
This commit is contained in:
Nassim Jahnke 2023-10-16 15:24:21 +10:00
parent 63c109efde
commit f243f76d6f
4 changed files with 15 additions and 3 deletions

View File

@ -32,7 +32,7 @@ This project also includes code from [adventure](https://github.com/KyoriPowered
<dependency>
<groupId>com.viaversion</groupId>
<artifactId>nbt</artifactId>
<version>3.0.0</version>
<version>3.1.0</version>
</dependency>
```

View File

@ -5,7 +5,7 @@
<groupId>com.viaversion</groupId>
<artifactId>nbt</artifactId>
<version>3.0.0</version>
<version>3.1.0</version>
<packaging>jar</packaging>
<name>ViaNBT</name>

View File

@ -77,7 +77,7 @@ public class ListTag extends Tag implements Iterable<Tag> {
*
* @return The ListTag's element type, or null if the list does not yet have a defined type.
*/
public Class<? extends Tag> getElementType() {
public @Nullable Class<? extends Tag> getElementType() {
return this.type;
}

View File

@ -46,4 +46,16 @@ public abstract class NumberTag extends Tag {
* @return Double value of this tag.
*/
public abstract double asDouble();
/**
* Gets the boolean value of this tag.
* <p>
* Booleans do not have a direct nbt representation in NBT per se,
* but check whether a number value is different to 0.
*
* @return Boolean value of this tag.
*/
public boolean asBoolean() {
return this.asByte() != 0;
}
}