Package net.minecraft.nbt
Record Class NbtString
java.lang.Object
java.lang.Record
net.minecraft.nbt.NbtString
- Record Components:
value-
- All Implemented Interfaces:
NbtElement,NbtPrimitive
Represents an NBT string. Its type is 0x8.
Instances are immutable.
- Mappings:
Namespace Name named net/minecraft/nbt/NbtStringintermediary net/minecraft/class_2519official uynamed valueintermediary comp_3831official b
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final charprivate static final charprivate static final NbtStringprivate static final charprivate static final charprivate static final intprivate final StringThe field for thevaluerecord component.Fields inherited from interface net.minecraft.nbt.NbtElement
BYTE_ARRAY_TYPE, BYTE_TYPE, COMPOUND_TYPE, DOUBLE_TYPE, END_TYPE, field_33246, field_33247, field_33248, field_33249, FLOAT_TYPE, INT_ARRAY_TYPE, INT_TYPE, LIST_TYPE, LONG_ARRAY_TYPE, LONG_TYPE, MAX_DEPTH, SHORT_TYPE, STRING_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(NbtElementVisitor visitor) static voidappendEscaped(String value, StringBuilder builder) asString()copy()Returns an NBT element of equal value that won't change with this element.doAccept(NbtScanner visitor) final booleanIndicates whether some other object is "equal to" this one.static StringReturns the string quoted with quotes and backslashes escaped.Returns the NBT type definition of this NBT element.intbytegetType()Returns the type of this NBT element.final inthashCode()Returns a hash code value for this object.static NbtStringReturns the NBT string fromvalue.static voidtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.voidwrite(DataOutput output) Writes the NBT element tooutput.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.nbt.NbtElement
accept, asBoolean, asByte, asByteArray, asCompound, asDouble, asFloat, asInt, asIntArray, asLong, asLongArray, asNbtList, asNumber, asShort
-
Field Details
-
value
The field for thevaluerecord component. -
SIZE
private static final int SIZE- See Also:
- Mappings:
Namespace Name Mixin selector named SIZELnet/minecraft/nbt/NbtString;SIZE:Iintermediary field_41729Lnet/minecraft/class_2519;field_41729:Iofficial cLuy;c:I
-
TYPE
- Mappings:
Namespace Name Mixin selector named TYPELnet/minecraft/nbt/NbtString;TYPE:Lnet/minecraft/nbt/NbtType;intermediary field_21045Lnet/minecraft/class_2519;field_21045:Lnet/minecraft/class_4614;official aLuy;a:Lvc;
-
EMPTY
- Mappings:
Namespace Name Mixin selector named EMPTYLnet/minecraft/nbt/NbtString;EMPTY:Lnet/minecraft/nbt/NbtString;intermediary field_21046Lnet/minecraft/class_2519;field_21046:Lnet/minecraft/class_2519;official vLuy;v:Luy;
-
DOUBLE_QUOTE
private static final char DOUBLE_QUOTE- See Also:
- Mappings:
Namespace Name Mixin selector named DOUBLE_QUOTELnet/minecraft/nbt/NbtString;DOUBLE_QUOTE:Cintermediary field_33242Lnet/minecraft/class_2519;field_33242:Cofficial wLuy;w:C
-
SINGLE_QUOTE
private static final char SINGLE_QUOTE- See Also:
- Mappings:
Namespace Name Mixin selector named SINGLE_QUOTELnet/minecraft/nbt/NbtString;SINGLE_QUOTE:Cintermediary field_33243Lnet/minecraft/class_2519;field_33243:Cofficial xLuy;x:C
-
BACKSLASH
private static final char BACKSLASH- See Also:
- Mappings:
Namespace Name Mixin selector named BACKSLASHLnet/minecraft/nbt/NbtString;BACKSLASH:Cintermediary field_33244Lnet/minecraft/class_2519;field_33244:Cofficial yLuy;y:C
-
NULL
private static final char NULL- See Also:
- Mappings:
Namespace Name Mixin selector named NULLLnet/minecraft/nbt/NbtString;NULL:Cintermediary field_33245Lnet/minecraft/class_2519;field_33245:Cofficial zLuy;z:C
-
-
Constructor Details
-
NbtString
Deprecated, for removal: This API element is subject to removal in a future version.Creates an instance of aNbtStringrecord class.- Parameters:
value- the value for thevaluerecord component
-
-
Method Details
-
skip
- Throws:
IOException- Mappings:
Namespace Name Mixin selector named skipLnet/minecraft/nbt/NbtString;skip(Ljava/io/DataInput;)Vintermediary method_39875Lnet/minecraft/class_2519;method_39875(Ljava/io/DataInput;)Vofficial aLuy;a(Ljava/io/DataInput;)V
-
of
Returns the NBT string fromvalue.- Returns:
- the NBT string from
value - Mappings:
Namespace Name Mixin selector named ofLnet/minecraft/nbt/NbtString;of(Ljava/lang/String;)Lnet/minecraft/nbt/NbtString;intermediary method_23256Lnet/minecraft/class_2519;method_23256(Ljava/lang/String;)Lnet/minecraft/class_2519;official aLuy;a(Ljava/lang/String;)Luy;
-
write
Writes the NBT element tooutput.- Specified by:
writein interfaceNbtElement- Throws:
IOException- API Note:
- This is a low-level method for serializing NBT elements; consider using
NbtIo,NbtOps, orPacketByteBuf.writeNbt(net.minecraft.nbt.NbtElement)instead. - Mappings:
Namespace Name Mixin selector named writeLnet/minecraft/nbt/NbtElement;write(Ljava/io/DataOutput;)Vintermediary method_10713Lnet/minecraft/class_2520;method_10713(Ljava/io/DataOutput;)Vofficial aLva;a(Ljava/io/DataOutput;)V
-
getSizeInBytes
public int getSizeInBytes()- Specified by:
getSizeInBytesin interfaceNbtElement- Mappings:
Namespace Name Mixin selector named getSizeInBytesLnet/minecraft/nbt/NbtElement;getSizeInBytes()Iintermediary method_47988Lnet/minecraft/class_2520;method_47988()Iofficial aLva;a()I
-
getType
public byte getType()Returns the type of this NBT element.- Specified by:
getTypein interfaceNbtElement- Returns:
- the type of this NBT element
- Mappings:
Namespace Name Mixin selector named getTypeLnet/minecraft/nbt/NbtElement;getType()Bintermediary method_10711Lnet/minecraft/class_2520;method_10711()Bofficial bLva;b()B
-
getNbtType
Returns the NBT type definition of this NBT element.- Specified by:
getNbtTypein interfaceNbtElement- Returns:
- the NBT type definition of this NBT element
- Mappings:
Namespace Name Mixin selector named getNbtTypeLnet/minecraft/nbt/NbtElement;getNbtType()Lnet/minecraft/nbt/NbtType;intermediary method_23258Lnet/minecraft/class_2520;method_23258()Lnet/minecraft/class_4614;official cLva;c()Lvc;
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.- Specified by:
toStringin interfaceNbtElement- Specified by:
toStringin classRecord- Returns:
- a string representation of this object
-
copy
Description copied from interface:NbtPrimitiveReturns an NBT element of equal value that won't change with this element.- Specified by:
copyin interfaceNbtElement- Specified by:
copyin interfaceNbtPrimitive- Returns:
- an NBT element of equal value that won't change with this element
- Mappings:
Namespace Name Mixin selector named copyLnet/minecraft/nbt/NbtString;copy()Lnet/minecraft/nbt/NbtString;intermediary method_10705Lnet/minecraft/class_2519;method_10705()Lnet/minecraft/class_2519;official eLuy;e()Luy;
-
asString
- Specified by:
asStringin interfaceNbtElement- Mappings:
Namespace Name Mixin selector named asStringLnet/minecraft/nbt/NbtElement;asString()Ljava/util/Optional;intermediary method_68658Lnet/minecraft/class_2520;method_68658()Ljava/util/Optional;official p_Lva;p_()Ljava/util/Optional;
-
accept
- Specified by:
acceptin interfaceNbtElement- Mappings:
Namespace Name Mixin selector named acceptLnet/minecraft/nbt/NbtElement;accept(Lnet/minecraft/nbt/visitor/NbtElementVisitor;)Vintermediary method_32289Lnet/minecraft/class_2520;method_32289(Lnet/minecraft/class_5627;)Vofficial aLva;a(Lve;)V
-
escape
Returns the string quoted with quotes and backslashes escaped.- Returns:
- the string quoted with quotes and backslashes escaped
- Implementation Note:
- If
valuecontains one of the singlequote or the double quote, it tries to use the other quotes to quote the string. If both appear, then the quote that appeared later will be used to quote the string. If neither of them appears, this uses a double quote. For example, the stringIt's a "Tiny Potato"!will be escaped as"It's a \"Tiny Potato\"!", while the stringIt is a "Tiny Potato"!will be escaped as'It is a "Tiny Potato"!'. - Mappings:
Namespace Name Mixin selector named escapeLnet/minecraft/nbt/NbtString;escape(Ljava/lang/String;)Ljava/lang/String;intermediary method_10706Lnet/minecraft/class_2519;method_10706(Ljava/lang/String;)Ljava/lang/String;official bLuy;b(Ljava/lang/String;)Ljava/lang/String;
-
appendEscaped
- Mappings:
Namespace Name Mixin selector named appendEscapedLnet/minecraft/nbt/NbtString;appendEscaped(Ljava/lang/String;Ljava/lang/StringBuilder;)Vintermediary method_68657Lnet/minecraft/class_2519;method_68657(Ljava/lang/String;Ljava/lang/StringBuilder;)Vofficial aLuy;a(Ljava/lang/String;Ljava/lang/StringBuilder;)V
-
doAccept
- Specified by:
doAcceptin interfaceNbtElement- Mappings:
Namespace Name Mixin selector named doAcceptLnet/minecraft/nbt/NbtElement;doAccept(Lnet/minecraft/nbt/scanner/NbtScanner;)Lnet/minecraft/nbt/scanner/NbtScanner$Result;intermediary method_39850Lnet/minecraft/class_2520;method_39850(Lnet/minecraft/class_6836;)Lnet/minecraft/class_6836$class_6838;official aLva;a(Lux;)Lux$b;
-
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-