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/NbtString
intermediary net/minecraft/class_2519
official uy
named value
intermediary comp_3831
official b
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final char
private static final char
private static final NbtString
private static final char
private static final char
private static final int
private final String
The field for thevalue
record 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 TypeMethodDescriptionvoid
accept
(NbtElementVisitor visitor) static void
appendEscaped
(String value, StringBuilder builder) asString()
copy()
Returns an NBT element of equal value that won't change with this element.doAccept
(NbtScanner visitor) final boolean
Indicates whether some other object is "equal to" this one.static String
Returns the string quoted with quotes and backslashes escaped.Returns the NBT type definition of this NBT element.int
byte
getType()
Returns the type of this NBT element.final int
hashCode()
Returns a hash code value for this object.static NbtString
Returns the NBT string fromvalue
.static void
toString()
Returns a string representation of this record class.value()
Returns the value of thevalue
record component.void
write
(DataOutput output) Writes the NBT element tooutput
.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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 thevalue
record component. -
SIZE
private static final int SIZE- See Also:
- Mappings:
Namespace Name Mixin selector named SIZE
Lnet/minecraft/nbt/NbtString;SIZE:I
intermediary field_41729
Lnet/minecraft/class_2519;field_41729:I
official c
Luy;c:I
-
TYPE
- Mappings:
Namespace Name Mixin selector named TYPE
Lnet/minecraft/nbt/NbtString;TYPE:Lnet/minecraft/nbt/NbtType;
intermediary field_21045
Lnet/minecraft/class_2519;field_21045:Lnet/minecraft/class_4614;
official a
Luy;a:Lvc;
-
EMPTY
- Mappings:
Namespace Name Mixin selector named EMPTY
Lnet/minecraft/nbt/NbtString;EMPTY:Lnet/minecraft/nbt/NbtString;
intermediary field_21046
Lnet/minecraft/class_2519;field_21046:Lnet/minecraft/class_2519;
official v
Luy;v:Luy;
-
DOUBLE_QUOTE
private static final char DOUBLE_QUOTE- See Also:
- Mappings:
Namespace Name Mixin selector named DOUBLE_QUOTE
Lnet/minecraft/nbt/NbtString;DOUBLE_QUOTE:C
intermediary field_33242
Lnet/minecraft/class_2519;field_33242:C
official w
Luy;w:C
-
SINGLE_QUOTE
private static final char SINGLE_QUOTE- See Also:
- Mappings:
Namespace Name Mixin selector named SINGLE_QUOTE
Lnet/minecraft/nbt/NbtString;SINGLE_QUOTE:C
intermediary field_33243
Lnet/minecraft/class_2519;field_33243:C
official x
Luy;x:C
-
BACKSLASH
private static final char BACKSLASH- See Also:
- Mappings:
Namespace Name Mixin selector named BACKSLASH
Lnet/minecraft/nbt/NbtString;BACKSLASH:C
intermediary field_33244
Lnet/minecraft/class_2519;field_33244:C
official y
Luy;y:C
-
NULL
private static final char NULL- See Also:
- Mappings:
Namespace Name Mixin selector named NULL
Lnet/minecraft/nbt/NbtString;NULL:C
intermediary field_33245
Lnet/minecraft/class_2519;field_33245:C
official z
Luy;z:C
-
-
Constructor Details
-
NbtString
Deprecated, for removal: This API element is subject to removal in a future version.Creates an instance of aNbtString
record class.- Parameters:
value
- the value for thevalue
record component
-
-
Method Details
-
skip
- Throws:
IOException
- Mappings:
Namespace Name Mixin selector named skip
Lnet/minecraft/nbt/NbtString;skip(Ljava/io/DataInput;)V
intermediary method_39875
Lnet/minecraft/class_2519;method_39875(Ljava/io/DataInput;)V
official a
Luy;a(Ljava/io/DataInput;)V
-
of
Returns the NBT string fromvalue
.- Returns:
- the NBT string from
value
- Mappings:
Namespace Name Mixin selector named of
Lnet/minecraft/nbt/NbtString;of(Ljava/lang/String;)Lnet/minecraft/nbt/NbtString;
intermediary method_23256
Lnet/minecraft/class_2519;method_23256(Ljava/lang/String;)Lnet/minecraft/class_2519;
official a
Luy;a(Ljava/lang/String;)Luy;
-
write
Writes the NBT element tooutput
.- Specified by:
write
in 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 write
Lnet/minecraft/nbt/NbtElement;write(Ljava/io/DataOutput;)V
intermediary method_10713
Lnet/minecraft/class_2520;method_10713(Ljava/io/DataOutput;)V
official a
Lva;a(Ljava/io/DataOutput;)V
-
getSizeInBytes
public int getSizeInBytes()- Specified by:
getSizeInBytes
in interfaceNbtElement
- Mappings:
Namespace Name Mixin selector named getSizeInBytes
Lnet/minecraft/nbt/NbtElement;getSizeInBytes()I
intermediary method_47988
Lnet/minecraft/class_2520;method_47988()I
official a
Lva;a()I
-
getType
public byte getType()Returns the type of this NBT element.- Specified by:
getType
in interfaceNbtElement
- Returns:
- the type of this NBT element
- Mappings:
Namespace Name Mixin selector named getType
Lnet/minecraft/nbt/NbtElement;getType()B
intermediary method_10711
Lnet/minecraft/class_2520;method_10711()B
official b
Lva;b()B
-
getNbtType
Returns the NBT type definition of this NBT element.- Specified by:
getNbtType
in interfaceNbtElement
- Returns:
- the NBT type definition of this NBT element
- Mappings:
Namespace Name Mixin selector named getNbtType
Lnet/minecraft/nbt/NbtElement;getNbtType()Lnet/minecraft/nbt/NbtType;
intermediary method_23258
Lnet/minecraft/class_2520;method_23258()Lnet/minecraft/class_4614;
official c
Lva;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:
toString
in interfaceNbtElement
- Specified by:
toString
in classRecord
- Returns:
- a string representation of this object
-
copy
Description copied from interface:NbtPrimitive
Returns an NBT element of equal value that won't change with this element.- Specified by:
copy
in interfaceNbtElement
- Specified by:
copy
in interfaceNbtPrimitive
- Returns:
- an NBT element of equal value that won't change with this element
- Mappings:
Namespace Name Mixin selector named copy
Lnet/minecraft/nbt/NbtString;copy()Lnet/minecraft/nbt/NbtString;
intermediary method_10705
Lnet/minecraft/class_2519;method_10705()Lnet/minecraft/class_2519;
official e
Luy;e()Luy;
-
asString
- Specified by:
asString
in interfaceNbtElement
- Mappings:
Namespace Name Mixin selector named asString
Lnet/minecraft/nbt/NbtElement;asString()Ljava/util/Optional;
intermediary method_68658
Lnet/minecraft/class_2520;method_68658()Ljava/util/Optional;
official p_
Lva;p_()Ljava/util/Optional;
-
accept
- Specified by:
accept
in interfaceNbtElement
- Mappings:
Namespace Name Mixin selector named accept
Lnet/minecraft/nbt/NbtElement;accept(Lnet/minecraft/nbt/visitor/NbtElementVisitor;)V
intermediary method_32289
Lnet/minecraft/class_2520;method_32289(Lnet/minecraft/class_5627;)V
official a
Lva;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
value
contains 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 escape
Lnet/minecraft/nbt/NbtString;escape(Ljava/lang/String;)Ljava/lang/String;
intermediary method_10706
Lnet/minecraft/class_2519;method_10706(Ljava/lang/String;)Ljava/lang/String;
official b
Luy;b(Ljava/lang/String;)Ljava/lang/String;
-
appendEscaped
- Mappings:
Namespace Name Mixin selector named appendEscaped
Lnet/minecraft/nbt/NbtString;appendEscaped(Ljava/lang/String;Ljava/lang/StringBuilder;)V
intermediary method_68657
Lnet/minecraft/class_2519;method_68657(Ljava/lang/String;Ljava/lang/StringBuilder;)V
official a
Luy;a(Ljava/lang/String;Ljava/lang/StringBuilder;)V
-
doAccept
- Specified by:
doAccept
in interfaceNbtElement
- Mappings:
Namespace Name Mixin selector named doAccept
Lnet/minecraft/nbt/NbtElement;doAccept(Lnet/minecraft/nbt/scanner/NbtScanner;)Lnet/minecraft/nbt/scanner/NbtScanner$Result;
intermediary method_39850
Lnet/minecraft/class_2520;method_39850(Lnet/minecraft/class_6836;)Lnet/minecraft/class_6836$class_6838;
official a
Lva;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 thevalue
record component.- Returns:
- the value of the
value
record component
-