ByteTag.java
net.minecraft.nbt.ByteTag
信息
- 全限定名:net.minecraft.nbt.ByteTag
- 类型:public record
- 包:net.minecraft.nbt
- 源码路径:src/main/java/net/minecraft/nbt/ByteTag.java
- 起始行号:L7
- 实现:NumericTag
- 职责:
TODO
字段/常量
-
SELF_SIZE_IN_BYTES- 类型:
int - 修饰符:
private static final - 源码定位:
L8 - 说明:
TODO
- 类型:
-
TYPE- 类型:
TagType<ByteTag> - 修饰符:
public static final public public private static public public public - 源码定位:
L9 - 说明:
TODO
- 类型:
-
ZERO- 类型:
ByteTag - 修饰符:
public static final - 源码定位:
L39 - 说明:
TODO
- 类型:
-
ONE- 类型:
ByteTag - 修饰符:
public static final - 源码定位:
L40 - 说明:
TODO
- 类型:
内部类/嵌套类型
net.minecraft.nbt.ByteTag.Cache- 类型:
class - 修饰符:
private static - 源码定位:
L131 - 说明:
TODO
- 类型:
构造器
public ByteTag(byte value) @ L42
- 构造器名:ByteTag
- 源码定位:L42
- 修饰符:public
参数:
- value: byte
说明:
TODO
方法
下面的方法块按源码顺序生成。
public static ByteTag valueOf(byte data) @ L47
- 方法名:valueOf
- 源码定位:L47
- 返回类型:ByteTag
- 修饰符:public static
参数:
- data: byte
说明:
TODO
public static ByteTag valueOf(boolean data) @ L51
- 方法名:valueOf
- 源码定位:L51
- 返回类型:ByteTag
- 修饰符:public static
参数:
- data: boolean
说明:
TODO
public void write(DataOutput output) @ L55
- 方法名:write
- 源码定位:L55
- 返回类型:void
- 修饰符:public
参数:
- output: DataOutput
说明:
TODO
public int sizeInBytes() @ L60
- 方法名:sizeInBytes
- 源码定位:L60
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public byte getId() @ L65
- 方法名:getId
- 源码定位:L65
- 返回类型:byte
- 修饰符:public
参数:
- 无
说明:
TODO
public TagType<ByteTag> getType() @ L70
- 方法名:getType
- 源码定位:L70
- 返回类型:TagType
- 修饰符:public
参数:
- 无
说明:
TODO
public ByteTag copy() @ L75
- 方法名:copy
- 源码定位:L75
- 返回类型:ByteTag
- 修饰符:public
参数:
- 无
说明:
TODO
public void accept(TagVisitor visitor) @ L79
- 方法名:accept
- 源码定位:L79
- 返回类型:void
- 修饰符:public
参数:
- visitor: TagVisitor
说明:
TODO
public long longValue() @ L84
- 方法名:longValue
- 源码定位:L84
- 返回类型:long
- 修饰符:public
参数:
- 无
说明:
TODO
public int intValue() @ L89
- 方法名:intValue
- 源码定位:L89
- 返回类型:int
- 修饰符:public
参数:
- 无
说明:
TODO
public short shortValue() @ L94
- 方法名:shortValue
- 源码定位:L94
- 返回类型:short
- 修饰符:public
参数:
- 无
说明:
TODO
public byte byteValue() @ L99
- 方法名:byteValue
- 源码定位:L99
- 返回类型:byte
- 修饰符:public
参数:
- 无
说明:
TODO
public double doubleValue() @ L104
- 方法名:doubleValue
- 源码定位:L104
- 返回类型:double
- 修饰符:public
参数:
- 无
说明:
TODO
public float floatValue() @ L109
- 方法名:floatValue
- 源码定位:L109
- 返回类型:float
- 修饰符:public
参数:
- 无
说明:
TODO
public Number box() @ L114
- 方法名:box
- 源码定位:L114
- 返回类型:Number
- 修饰符:public
参数:
- 无
说明:
TODO
public StreamTagVisitor.ValueResult accept(StreamTagVisitor visitor) @ L119
- 方法名:accept
- 源码定位:L119
- 返回类型:StreamTagVisitor.ValueResult
- 修饰符:public
参数:
- visitor: StreamTagVisitor
说明:
TODO
public String toString() @ L124
- 方法名:toString
- 源码定位:L124
- 返回类型:String
- 修饰符:public
参数:
- 无
说明:
TODO
代码
public record ByteTag(byte value) implements NumericTag {
private static final int SELF_SIZE_IN_BYTES = 9;
public static final TagType<ByteTag> TYPE = new TagType.StaticSize<ByteTag>() {
public ByteTag load(DataInput input, NbtAccounter accounter) throws IOException {
return ByteTag.valueOf(readAccounted(input, accounter));
}
@Override
public StreamTagVisitor.ValueResult parse(DataInput input, StreamTagVisitor output, NbtAccounter accounter) throws IOException {
return output.visit(readAccounted(input, accounter));
}
private static byte readAccounted(DataInput input, NbtAccounter accounter) throws IOException {
accounter.accountBytes(9L);
return input.readByte();
}
@Override
public int size() {
return 1;
}
@Override
public String getName() {
return "BYTE";
}
@Override
public String getPrettyName() {
return "TAG_Byte";
}
};
public static final ByteTag ZERO = valueOf((byte)0);
public static final ByteTag ONE = valueOf((byte)1);
@Deprecated(forRemoval = true)
public ByteTag(byte value) {
this.value = value;
}
public static ByteTag valueOf(byte data) {
return ByteTag.Cache.cache[128 + data];
}
public static ByteTag valueOf(boolean data) {
return data ? ONE : ZERO;
}
@Override
public void write(DataOutput output) throws IOException {
output.writeByte(this.value);
}
@Override
public int sizeInBytes() {
return 9;
}
@Override
public byte getId() {
return 1;
}
@Override
public TagType<ByteTag> getType() {
return TYPE;
}
public ByteTag copy() {
return this;
}
@Override
public void accept(TagVisitor visitor) {
visitor.visitByte(this);
}
@Override
public long longValue() {
return this.value;
}
@Override
public int intValue() {
return this.value;
}
@Override
public short shortValue() {
return this.value;
}
@Override
public byte byteValue() {
return this.value;
}
@Override
public double doubleValue() {
return this.value;
}
@Override
public float floatValue() {
return this.value;
}
@Override
public Number box() {
return this.value;
}
@Override
public StreamTagVisitor.ValueResult accept(StreamTagVisitor visitor) {
return visitor.visit(this.value);
}
@Override
public String toString() {
StringTagVisitor visitor = new StringTagVisitor();
visitor.visitByte(this);
return visitor.build();
}
private static class Cache {
private static final ByteTag[] cache = new ByteTag[256];
static {
for (int i = 0; i < cache.length; i++) {
cache[i] = new ByteTag((byte)(i - 128));
}
}
}
}引用的其他类
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
参数/返回值
- 引用位置:
-
- 引用位置:
构造调用 - 关联成员:
StringTagVisitor()
- 引用位置:
-
- 引用位置:
字段/返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置: