Add ByteTag boolean constructor

This commit is contained in:
Nassim Jahnke 2024-02-29 13:45:43 +01:00
parent eec9aca691
commit 9f71f9b978
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
2 changed files with 10 additions and 1 deletions

View File

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

View File

@ -28,6 +28,15 @@ public class ByteTag extends NumberTag {
this.value = value;
}
/**
* Creates a tag.
*
* @param value The value of the tag.
*/
public ByteTag(boolean value) {
this.value = (byte) (value ? 1 : 0);
}
public static ByteTag read(DataInput in, TagLimiter tagLimiter) throws IOException {
tagLimiter.countByte();
return new ByteTag(in.readByte());